From debbugs-submit-bounces@debbugs.gnu.org Fri Jul 18 22:04:47 2025 Received: (at submit) by debbugs.gnu.org; 19 Jul 2025 02:04:47 +0000 Received: from localhost ([127.0.0.1]:37572 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ucwwR-00020U-DJ for submit@debbugs.gnu.org; Fri, 18 Jul 2025 22:04:47 -0400 Received: from lists.gnu.org ([2001:470:142::17]:56262) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ucwwO-0001yy-F5 for submit@debbugs.gnu.org; Fri, 18 Jul 2025 22:04:45 -0400 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 1ucwvy-0000a9-Ff for bug-gnu-emacs@gnu.org; Fri, 18 Jul 2025 22:04:19 -0400 Received: from mail-ot1-x342.google.com ([2607:f8b0:4864:20::342]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ucwvw-0000lJ-M6 for bug-gnu-emacs@gnu.org; Fri, 18 Jul 2025 22:04:17 -0400 Received: by mail-ot1-x342.google.com with SMTP id 46e09a7af769-72c14138668so1090803a34.2 for ; Fri, 18 Jul 2025 19:04:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1752890654; x=1753495454; darn=gnu.org; h=mime-version:message-id:date:subject:to:from:from:to:cc:subject :date:message-id:reply-to; bh=PPU1rPbjDN2eV3vZJ49QzGliUzIAEVx6EY/YF9ijCps=; b=H2IzDYYyDjRj15W6blqlEcI3eF9LxlgXZYQFZt7FZ81Vtyqpb0GVgZYyoHjTSxQsxE 8QhedHn1JPOgPbsBOS5z1+sz3c3hbZ0Msdso6Jci5ZCxBwDGHxuok1oqHS8VNTvIPlYl pi8R9yAoWW7S/9sbA8gsfV4aV/KXg/IpsVzI9ETSPqLggCBHb0WglTZBLnxcmL2iBRPC dHnDEFpydUcevSKOGWbPKrtcu9L0uQD6iJ2SQ1MGcpV3hI44ilCUSuyc9vgyjyO8m29i j9ZFPUEF+t6bbKjArFtTVePwdfcyZj8gcA2/pLwgvkFH2+Y5MUtR98yCbjqGogk7CaKV 9PJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752890654; x=1753495454; h=mime-version:message-id:date:subject:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=PPU1rPbjDN2eV3vZJ49QzGliUzIAEVx6EY/YF9ijCps=; b=MflUf3Sg3ePd2k98CYdm4G5Qo4SlSNnoLlOsyfKRFPqvOTeaG9DfhA8T/a53X3dTmg E6fXbtrYBVTtX6aLN1p9pIUnuy8FTslqIYREOyywE5fuB/Mkqv3wFDw3KiX4zhqxBDMA 9qPOd3LaJGX/Ci96AFQqmkiuTZhx5UnpSbazCmUMup55dJbhPrn5URHJ1CV/JL7aMU4J 6EGtQt/LNy4Za1pyOosQWbOcbU4wom1aQWKENEP4lhGrVGRVmnTWfQDt9vGwzstK0wu4 RLz9bbcgA21JbH07oizzrZ1BHPdnOi6CEC4t0VfYz4dR8ID4EzCqp9a0J5C9Jo/IDluq 8/xA== X-Gm-Message-State: AOJu0YypgabW6KQO52q3UnyCEh1uwiD2cixoKoEpLDukBZHgsi1cwB3F 5n/+ZWPN10uflNewJ5GByUJuizcBwfRC25u3qLDZU4627mTBfj3x1Fib11EZl3SK X-Gm-Gg: ASbGncvv/p4bCtl8tflY4W2tNBz3s8LGm4+6s3oofQPoE0mxeWHjSTmpc72jDYBEsvJ 4VlWhPErfXw/WFXyh84hWyHmdsvZp0eHkUWcGduOQpzmi0E6LmIAbP+UuXfZ/41R1sJgFBY6Rvq Zak48h6J/REvzGHFprF0LZeksRc1S/jSVHzet00P47+hhXHnIA7Z5IgFC+vopc9/Ocb1Gq0bLpJ QDt3gOk+rAEVyR+stZNvxiR/45q0N1NLvIz00IJ7/wKZ0NubPvtBFzWADb77Vl1kBubOg6uuJqk 4JSYxSiCAubFZvnDTcwGZiowQw5PvV8I4aS/Ui+dNB9IeqOaMaSWhUMMT2usyl/+ZppNmijA9Cv 8wXoZW1JhGgBI2iw= X-Google-Smtp-Source: AGHT+IFVWUzbARSVSa/BXezPDOe2/eC5fdmRoiXIvF9yYb5mymY00eINPTMBq3jy4Y0xxetJFozVfw== X-Received: by 2002:a05:6830:3483:b0:73e:655f:45de with SMTP id 46e09a7af769-73e83359e0fmr4172445a34.5.1752890654396; Fri, 18 Jul 2025 19:04:14 -0700 (PDT) Received: from fedora ([189.215.162.117]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-73e83be07c4sm1089864a34.61.2025.07.18.19.04.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Jul 2025 19:04:14 -0700 (PDT) From: =?utf-8?Q?Elijah_Gabe_P=C3=A9rez?= To: bug-gnu-emacs@gnu.org Subject: Add some multi-character pairs to some major modes. Date: Fri, 18 Jul 2025 20:04:12 -0600 Message-ID: <87ms91gcmb.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::342; envelope-from=eg642616@gmail.com; helo=mail-ot1-x342.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.2 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Since `electric-pair-mode` now supports multi-character pairs, it would be better if some major modes add some of these pairs. Before making the patch for this (and to avoid doing another regression like bug#77823), here is a list of the modes and their possible pairs: Content analysis details: (1.2 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (eg642616[at]gmail.com) 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (eg642616[at]gmail.com) -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2001:470:142:0:0:0:0:17 listed in] [list.dnswl.org] X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.2 (/) Since `electric-pair-mode` now supports multi-character pairs, it would be better if some major modes add some of these pairs. Before making the patch for this (and to avoid doing another regression like bug#77823), here is a list of the modes and their possible pairs: - c-like modes "/*" "*/" - lua-ts-mode "--[" "--]" - texinfo-mode (idk which others one) (based in a Stefan Monnier idea) "``" "''" - lisp-mode (common-lisp-mode) "#|" "|#" What do you think? -- - E.G via GNU Emacs and Org. From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 19 02:43:12 2025 Received: (at 79047) by debbugs.gnu.org; 19 Jul 2025 06:43:12 +0000 Received: from localhost ([127.0.0.1]:38994 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ud1Hr-0007Xc-GI for submit@debbugs.gnu.org; Sat, 19 Jul 2025 02:43:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45950) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ud1Hp-0007XG-JL for 79047@debbugs.gnu.org; Sat, 19 Jul 2025 02:43:10 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ud1Hh-0003YH-AV; Sat, 19 Jul 2025 02:43:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=pbhE0IZ8rkoVC87aoUKGhRWx2FHSd+/aGt5a+hq+wz8=; b=MeMgQABtHKUMxH5qFNsf RJiR/pMztFOVy3/R7Smbp/aIsEJjjN3ub67QKPxrdrNPghl35hteTFBsWJ0fapkJ/1DRO0m85JTHa +WYf+jTs9gResjb/H54Fp+T/9penuOvFwmORNzbEpVzvcMCidxltt5opeLFS90JERh6H5Q2LbgRVb v35KUwYCg8OuZXTKnSCe/gUMnQ4MfmdlosTn0n8zhKtjMBlArqUMXm0covV32Grkk/P0LzjwIeUf7 FhPzDgDaq9FsDXdCqwWOXueRjU5SJ8XVjlXGP1hosrN+HDAQt5BjS6tKW5zAok02D5C1hdzL+RaDd jaWG7FOOtq+2Cw==; Date: Sat, 19 Jul 2025 09:42:52 +0300 Message-Id: <867c04fzpv.fsf@gnu.org> From: Eli Zaretskii To: Elijah Gabe =?iso-8859-1?Q?P=E9rez?= , Alan Mackenzie , John Muhl , Stefan Monnier In-Reply-To: <87ms91gcmb.fsf@gmail.com> (message from Elijah Gabe =?iso-8859-1?Q?P=E9rez?= on Fri, 18 Jul 2025 20:04:12 -0600) Subject: Re: bug#79047: Add some multi-character pairs to some major modes. References: <87ms91gcmb.fsf@gmail.com> MIME-version: 1.0 Content-type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 79047 Cc: 79047@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Elijah Gabe Pérez > Date: Fri, 18 Jul 2025 20:04:12 -0600 > > Since `electric-pair-mode` now supports multi-character pairs, it would > be better if some major modes add some of these pairs. > > Before making the patch for this (and to avoid doing another regression > like bug#77823), here is a list of the modes and their possible pairs: > > - c-like modes > "/*" "*/" > - lua-ts-mode > "--[" "--]" > - texinfo-mode (idk which others one) (based in a Stefan Monnier idea) > "``" "''" > - lisp-mode (common-lisp-mode) > "#|" "|#" > > What do you think? When discussing in a bug report issues related to some specific packages, it is usually a good idea to CC the authors/developers of those packages, because we cannot be sure they track the bug-gnu-emacs list all the time. I've now added people who I think are relevant to your proposal. Thanks. From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 19 07:00:32 2025 Received: (at 79047) by debbugs.gnu.org; 19 Jul 2025 11:00:32 +0000 Received: from localhost ([127.0.0.1]:40457 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ud5Iu-0002Hc-7F for submit@debbugs.gnu.org; Sat, 19 Jul 2025 07:00:32 -0400 Received: from mail.muc.de ([193.149.48.3]:61336) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ud5Iq-0002HC-Qg for 79047@debbugs.gnu.org; Sat, 19 Jul 2025 07:00:30 -0400 Received: (qmail 32634 invoked by uid 3782); 19 Jul 2025 13:00:22 +0200 Received: from muc.de (pd953aea6.dip0.t-ipconnect.de [217.83.174.166]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Sat, 19 Jul 2025 13:00:21 +0200 Received: (qmail 8504 invoked by uid 1000); 19 Jul 2025 11:00:21 -0000 Date: Sat, 19 Jul 2025 11:00:21 +0000 To: Eli Zaretskii , Elijah Gabe =?iso-8859-1?Q?P=E9rez?= Subject: Re: bug#79047: Add some multi-character pairs to some major modes. Message-ID: References: <87ms91gcmb.fsf@gmail.com> <867c04fzpv.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <867c04fzpv.fsf@gnu.org> X-Submission-Agent: TMDA/1.3.x (Ph3nix) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 79047 Cc: 79047@debbugs.gnu.org, acm@muc.de, John Muhl , Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello, Eli. Thanks for the heads up! On Sat, Jul 19, 2025 at 09:42:52 +0300, Eli Zaretskii wrote: > > From: Elijah Gabe Pérez > > Date: Fri, 18 Jul 2025 20:04:12 -0600 > > Since `electric-pair-mode` now supports multi-character pairs, it would > > be better if some major modes add some of these pairs. > > Before making the patch for this (and to avoid doing another regression > > like bug#77823), here is a list of the modes and their possible pairs: > > - c-like modes > > "/*" "*/" Elijah, I'm speaking here from the point of view of CC Mode. What exactly do you mean by "adding" these multi-character pairs? What would the user see that she doesn't already see? Or are you talking about doing something we already do, but in a different way? > > - lua-ts-mode > > "--[" "--]" > > - texinfo-mode (idk which others one) (based in a Stefan Monnier idea) > > "``" "''" > > - lisp-mode (common-lisp-mode) > > "#|" "|#" > > What do you think? > When discussing in a bug report issues related to some specific > packages, it is usually a good idea to CC the authors/developers of > those packages, because we cannot be sure they track the bug-gnu-emacs > list all the time. > I've now added people who I think are relevant to your proposal. > Thanks. -- Alan Mackenzie (Nuremberg, Germany). From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 19 12:39:15 2025 Received: (at 79047) by debbugs.gnu.org; 19 Jul 2025 16:39:15 +0000 Received: from localhost ([127.0.0.1]:43886 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1udAah-0005iH-30 for submit@debbugs.gnu.org; Sat, 19 Jul 2025 12:39:15 -0400 Received: from mail-ot1-x342.google.com ([2607:f8b0:4864:20::342]:55700) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1udAae-0005hj-Pe for 79047@debbugs.gnu.org; Sat, 19 Jul 2025 12:39:13 -0400 Received: by mail-ot1-x342.google.com with SMTP id 46e09a7af769-73e810dc03bso392216a34.3 for <79047@debbugs.gnu.org>; Sat, 19 Jul 2025 09:39:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1752943147; x=1753547947; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=dyWNHLYAKR9nBnOfeU1NAhp7p3R+xw87od28A4xMSnE=; b=aoRLl4Yeqmdaz0H4DVMPxf4CZMpkGR0o1xCoFAnwLLGvZ8KZFCq8vhwvPXR9uix90o qZQSBZcvxz/FJDWFzDFB9YLoVWj41YawETZtNB508IBmu1cHldDE3aeESDA72IK7pgNt y67oBc61aXD075NnbNl2WYQZFODDtmWG46JSahevuYYuvwG/IeMPuhLavFov+pqqQ9cr L7GnbqQo20SZZng6j7Rd+PdWMgAjiAyrO7+p9dB+WklKcbCFFPLnbf+xwLplC7dxZd4L oJkmAZZIUaCJPxrmiJZZRk4t6tdJ71vubBslaId/WFn3/yge32Ba9yA6dtKdsZp8iUfl S20w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752943147; x=1753547947; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=dyWNHLYAKR9nBnOfeU1NAhp7p3R+xw87od28A4xMSnE=; b=GfyBm+71XTYKKAlF/tDu1khDai9iIc3SvBgJzBeRWR5MY2IagNnpnrTTOiY8oq7jeW VyeqIr7Zv64USS9+hdhlraPB4He+SN4cj+YriRI+BYWjLfOf/ixeHiP8KBk3OUfitccQ GI7MJwtPUgr29eaRshvj4Epz3dAA6mje376Xt4x+CduzNLv4x2cD3lTA85TkXlXkiS84 vReT1KYSwyFS+9nZYH9gvWaGgW+o1sdFXUz/4j2J4rTI2eSs3lPwXAqx2fhbZ1hdxYd4 fjgLlW5j4ORf8cJ8MLhDKQ1FGCpjvzMnJa91er2gfL7KEmLDLrBxiJCyvbL8BcYXDc9M MeSA== X-Forwarded-Encrypted: i=1; AJvYcCUN3jecPhR1ahpIiIzQ3s5BvIZCYIBN9BWW6NjKBd+xPZVswtcaNbCOsfKPcB57650yqizb8A==@debbugs.gnu.org X-Gm-Message-State: AOJu0YwJI1Cc9eqVHEPABcu9ZCd6etqQbw0PVwBO2AovUhnlJ+iSd/v8 YTlRZZW4WVLBGf3cgL2TEexGE7bcp6jug/+AJpTGguvY7+UskeYRGcPD X-Gm-Gg: ASbGncvf8rNjL/oYI/dTxUpd8Z/Dx3lEMzkqH4FMnyyf/JDInK9xzxcRTm0JC99faU5 7HD1zAWxZaEWIICmHOGUWHL5yawhV9VEehbb/RAkLopPoBi78R6+T2fAlfqhsdyZk0vGxZHTBz7 S5y6XsghtGMIl6BjHU9u3tzUkxxEjV/+yAq3U/7GfWAtW5CitOYwxLBqjd5V2ArrAmTUJ4Jp7qW x7+h8ErOaKpud4xJty3/wkK92b8oQzp/1hZsAzt36KzUqwLlc0ZrgCnXzS+FfYYMtnVkG8usNzs RwbciUF0s/GaQbkbyoMZ6htXF4mxjQxN4q9epxgIz4cY1wLTqIQHvedvIVTtRcADdjsWAHW4ALh Voj1oYL2/QqYPmxM= X-Google-Smtp-Source: AGHT+IE1p4omr2bbxHA/JpOZAxkYgw4z76fW6n7fclmTCffPlfovcSO6JCkxNJ2g7cKBE7F4DYutkw== X-Received: by 2002:a05:6830:6f48:b0:73e:6313:3fdf with SMTP id 46e09a7af769-73e662c8423mr13136634a34.16.1752943146901; Sat, 19 Jul 2025 09:39:06 -0700 (PDT) Received: from fedora ([189.215.162.117]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-615bcda4dc6sm839945eaf.27.2025.07.19.09.39.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Jul 2025 09:39:06 -0700 (PDT) From: =?utf-8?Q?Elijah_Gabe_P=C3=A9rez?= To: Alan Mackenzie Subject: Re: bug#79047: Add some multi-character pairs to some major modes. In-Reply-To: References: <87ms91gcmb.fsf@gmail.com> <867c04fzpv.fsf@gnu.org> Date: Sat, 19 Jul 2025 10:39:03 -0600 Message-ID: <87seisdtjs.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 79047 Cc: 79047@debbugs.gnu.org, Eli Zaretskii , John Muhl , Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Alan Mackenzie writes: >> > From: Elijah Gabe P=C3=A9rez >> > Date: Fri, 18 Jul 2025 20:04:12 -0600 > >> > Since `electric-pair-mode` now supports multi-character pairs, it would >> > be better if some major modes add some of these pairs. > >> > Before making the patch for this (and to avoid doing another regression >> > like bug#77823), here is a list of the modes and their possible pairs: > >> > - c-like modes >> > "/*" "*/" > > Elijah, I'm speaking here from the point of view of CC Mode. > > What exactly do you mean by "adding" these multi-character pairs? What > would the user see that she doesn't already see? These pairs are meant to be used in for auto-close block comments, after the user types "/*", the corresponding "*/" will be inserted, packages such as smartparens provide this behavior to most C-like modes. > Or are you talking about doing something we already do, but in a > different way? I don't know if CC Mode have something similar. --=20 - E.G via GNU Emacs and Org. From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 19 12:52:56 2025 Received: (at 79047) by debbugs.gnu.org; 19 Jul 2025 16:52:56 +0000 Received: from localhost ([127.0.0.1]:43958 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1udAnw-0006f0-8S for submit@debbugs.gnu.org; Sat, 19 Jul 2025 12:52:56 -0400 Received: from mail.muc.de ([193.149.48.3]:34163) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1udAnt-0006eX-8G for 79047@debbugs.gnu.org; Sat, 19 Jul 2025 12:52:54 -0400 Received: (qmail 59894 invoked by uid 3782); 19 Jul 2025 18:52:46 +0200 Received: from muc.de (pd953aea6.dip0.t-ipconnect.de [217.83.174.166]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Sat, 19 Jul 2025 18:52:46 +0200 Received: (qmail 18057 invoked by uid 1000); 19 Jul 2025 16:52:45 -0000 Date: Sat, 19 Jul 2025 16:52:45 +0000 To: Elijah Gabe =?iso-8859-1?Q?P=E9rez?= Subject: Re: bug#79047: Add some multi-character pairs to some major modes. Message-ID: References: <87ms91gcmb.fsf@gmail.com> <867c04fzpv.fsf@gnu.org> <87seisdtjs.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <87seisdtjs.fsf@gmail.com> X-Submission-Agent: TMDA/1.3.x (Ph3nix) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 79047 Cc: 79047@debbugs.gnu.org, acm@muc.de, Eli Zaretskii , John Muhl , Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello, Elijah. On Sat, Jul 19, 2025 at 10:39:03 -0600, Elijah Gabe Pérez wrote: > Alan Mackenzie writes: > >> > From: Elijah Gabe Pérez > >> > Date: Fri, 18 Jul 2025 20:04:12 -0600 > >> > Since `electric-pair-mode` now supports multi-character pairs, it would > >> > be better if some major modes add some of these pairs. > >> > Before making the patch for this (and to avoid doing another regression > >> > like bug#77823), here is a list of the modes and their possible pairs: > >> > - c-like modes > >> > "/*" "*/" > > Elijah, I'm speaking here from the point of view of CC Mode. > > What exactly do you mean by "adding" these multi-character pairs? What > > would the user see that she doesn't already see? > These pairs are meant to be used in for auto-close block comments, after > the user types "/*", the corresponding "*/" will be inserted, packages > such as smartparens provide this behavior to most C-like modes. OK, thanks. But who's going to want to do this when there's M-; `comment-dwim' which inserts both the comment opener and comment closer in a single key stroke? Surely anybody typing /* explicitly will being doing so on a rare occasion when she _doesn't_ want the closing */ also inserted. > > Or are you talking about doing something we already do, but in a > > different way? > I don't know if CC Mode have something similar. M-; is common to most (?all) programming and text modes. > -- > - E.G via GNU Emacs and Org. -- Alan Mackenzie (Nuremberg, Germany). From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 19 14:27:11 2025 Received: (at 79047) by debbugs.gnu.org; 19 Jul 2025 18:27:11 +0000 Received: from localhost ([127.0.0.1]:44478 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1udCH8-0006wR-NO for submit@debbugs.gnu.org; Sat, 19 Jul 2025 14:27:11 -0400 Received: from mail-ot1-x344.google.com ([2607:f8b0:4864:20::344]:60695) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1udCH5-0006w1-Ni for 79047@debbugs.gnu.org; Sat, 19 Jul 2025 14:27:08 -0400 Received: by mail-ot1-x344.google.com with SMTP id 46e09a7af769-73e7e4432f5so1598959a34.1 for <79047@debbugs.gnu.org>; Sat, 19 Jul 2025 11:27:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1752949622; x=1753554422; darn=debbugs.gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=xXg+oo7KWv0aWVxvtkmNEkA3jOBvQ9e8j5b8Acgz7tA=; b=OWtfEFJ20szQsAheWMDBqSAOo0YG4BkrDa6wBj7N50ixtzMD3x+7QQfOkOgU91maFa NATCzS8obksKVPoO4v3Vy+PzN9WIWxhHfdjpj9YzSwCtU5mSca59LK7D7p2Hc8tympSS AOshdQzujnFnmWYUGm0zDbkQNlTcoMp1JSaQlkTm25JPfdpL13PHpc5Eb+V/eBO5fPxW cI4xxBqMWB2t+cg1eGMDvEC4Hl6mxOLCnDQJgVr++qCxcMHgse0m3IOJIMfDSN0Wbm/h 0p37N28UweSyhpHfGjg0VdslEzeX95v9qAK2Db54WaYheQKU/6SMYZoGUnOoCQcZcYZ9 ApoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752949622; x=1753554422; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=xXg+oo7KWv0aWVxvtkmNEkA3jOBvQ9e8j5b8Acgz7tA=; b=f/JXah5IWwFz+usF3+RiADe8C2WjbDDr10P6YyEHQu7K89Jl3KVMWeklMbUSl1MUPO wNrAM3kSkTq+T6Igh82Uvp+M+6OjmkZ8Ks1FZfku8+IrKVPlUDNma7q6twUpiU6uSl8g SCzgNLZsg5bdQfsSEIYvCWSNGP5O3RSH/eNeE5yIW0b/tM02CLYuflEDRGikWMoXpngG pzhubI+JLInrIn2p1CmK75TfmDOrwLzOAIMhA2+oWnksj72mWWFGTIsOv4OFxDMo9WDb zdMF3fw5UiVMZHgHRKuyih+QoLqZSGY5auXtkMySkVp2y/X4vPk+veWiORPNsXMJzDbQ oSvg== X-Gm-Message-State: AOJu0Yysd5rjWhLR3g8ET8yVOhABkgbj4/V6lFQkBiz5Rn2yl8cpMVNu T8XLNuHbDA82AbNATSEPtY+wNvnHnEbcWn+xDH5DPoFbljGvn3DXdCHA9UoU2XXz X-Gm-Gg: ASbGnctQF3EpKRqcEcir/gX64CURVUm/tcKCmT+fudGMy2g3jp4nQsnBIMjjxhp7+K3 gIn4UP43vSjVzzo5IQVHKWxgjFQr4Vh30dYbcUXfgEdavGeN9+i4v4mmf2nq10oe6N2oKwMra4g VzSCxcMNv/lCkOCFR54HaJGsf5L4KET6xxbEXc2+ZwBurN8iSIpDenfJI8HhYEzE70XzeQB9pix goGzaREf9V++KLBTvO6hPyBex9tHuJiH3zid8M6NXfc0QTbnsqxBTAQIbI2kRZg644h2z0JqOjW gHb5Aye92CuG96t++uYaAMDqW/E92DBgUOGZ1BtHAlFZpxOt9b+fniYWR7+BXUUV30ai5biWXVQ mdaHnwGGuHB7q9qE= X-Google-Smtp-Source: AGHT+IFbbPg6BH48d+sabVwZhbJntJDfcpqYuVf5OU6cyBUhb9H9lOAanU3kg0WYZX3RYhUiJS9KNw== X-Received: by 2002:a05:6830:4110:b0:73b:2617:87f1 with SMTP id 46e09a7af769-73e665e0854mr11950117a34.28.1752949621708; Sat, 19 Jul 2025 11:27:01 -0700 (PDT) Received: from fedora ([189.215.162.117]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-73e8366da85sm1501187a34.22.2025.07.19.11.27.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Jul 2025 11:27:01 -0700 (PDT) From: =?utf-8?Q?Elijah_Gabe_P=C3=A9rez?= To: Alan Mackenzie Subject: Re: bug#79047: Add some multi-character pairs to some major modes. In-Reply-To: References: <87ms91gcmb.fsf@gmail.com> <867c04fzpv.fsf@gnu.org> <87seisdtjs.fsf@gmail.com> Date: Sat, 19 Jul 2025 12:26:59 -0600 Message-ID: <87ldokdojw.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 79047 Cc: 79047@debbugs.gnu.org, Eli Zaretskii , John Muhl , Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Alan Mackenzie writes: >> > Elijah, I'm speaking here from the point of view of CC Mode. > >> > What exactly do you mean by "adding" these multi-character pairs? What >> > would the user see that she doesn't already see? > >> These pairs are meant to be used in for auto-close block comments, after >> the user types "/*", the corresponding "*/" will be inserted, packages >> such as smartparens provide this behavior to most C-like modes. > > OK, thanks. > > But who's going to want to do this when there's M-; `comment-dwim' which > inserts both the comment opener and comment closer in a single key > stroke? comment-dwim sometimes doesn't insert the comments where i want, it mostly insert the comments at the end of the line, or indent them according to `comment-column` (which ofc can be configured, but in most the cases, it will not work as expected). > Surely anybody typing /* explicitly will being doing so on a > rare occasion when she _doesn't_ want the closing */ also inserted. The feature can be optional, enabled via an user option or command, similar to `c-toggle-auto-newline`. >> > Or are you talking about doing something we already do, but in a >> > different way? > >> I don't know if CC Mode have something similar. > > M-; is common to most (?all) programming and text modes. Right, but calling comment-dwim in some modes doesn't insert a block comment, even if those modes supports block comments, (e.g. js-mode) -- - E.G via GNU Emacs and Org. From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 19 14:52:02 2025 Received: (at 79047) by debbugs.gnu.org; 19 Jul 2025 18:52:02 +0000 Received: from localhost ([127.0.0.1]:44660 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1udCfB-0000sQ-Jg for submit@debbugs.gnu.org; Sat, 19 Jul 2025 14:52:02 -0400 Received: from fhigh-b7-smtp.messagingengine.com ([202.12.124.158]:57923) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1udCf7-0000re-BB for 79047@debbugs.gnu.org; Sat, 19 Jul 2025 14:51:59 -0400 Received: from phl-compute-10.internal (phl-compute-10.phl.internal [10.202.2.50]) by mailfhigh.stl.internal (Postfix) with ESMTP id 77DFD7A0062; Sat, 19 Jul 2025 14:51:51 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-10.internal (MEProxy); Sat, 19 Jul 2025 14:51:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pub.pink; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1752951111; x=1753037511; bh=vKH4WjvkrWMuR7JHnDt0j9vCSxN2RhJwBa6FXqtywTo=; b= 1lf8QUb9rLesRMkhXt+w1G8XVqFmth0G+axHLVu9aBLOtoxVKGMFb53vbxe2OUz4 Wf7vFIV0o54hezt/78QNp7788NEmA0e/86Dg360lbrYGg3EdARMEmYasGaXM3aMT cQpLJTmzviiAoYleaWfCFHG4n+9mwmSrGERHTGsH7XkBy3zv/2tO3+4jx5M9c6HX Eg3NE/+GbExbJnBjVVolMmBOHQn7fwRXyO4GhBPEV8+FqWJ9owLMYBtZz5NLyl+p kgxM9Fd/DqdCFG5CDTuWzhbPXYvUQ6Qqrbol2Ufq9Hc8QdS2am8fQKxwTTWVAL72 +OMp8p3/DbAAlAjgAIR7Rw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1752951111; x= 1753037511; bh=vKH4WjvkrWMuR7JHnDt0j9vCSxN2RhJwBa6FXqtywTo=; b=I nwCqm7AM2oUbPTeXDERECbESSYJ9n1IvFzVKFGrrh02IFyaRGeA09XBedwtIyGEq GIkqlDdmO6IoSojud38/NHaH9AsfciCJxtzhV/PgKg8fJ6UMB4Qv+MCiV5w+Ld6s o1vT1YDl31lPvqdIdaiFISonM6fGOY5oX9uXygxK7yoIpd+o+N3MjE82Dn4AGW2h zmsH45b2CobtPPnAUxUKouiJ1J8giykqaSELmwO/uMYvVysjgKIxo9hAcPvhF01/ 0uzTz7MuUjWg3Vw1WJagn67MxstHc/HvNsahl0iwSfl02n59nHCgSgkiOh3MetnN 7QY9psvm4DzjcLOo033AQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgdeijedutdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpefhvfevufgjfhffkfgfgggtgfesthhqredttderjeenucfhrhhomhepjhhohhhnuchm uhhhlhcuoehjmhesphhusgdrphhinhhkqeenucggtffrrghtthgvrhhnpedtjeethfefve evgfevheehtddvteejveejieffteehheehfffgffeuleeiueejffenucevlhhushhtvghr ufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehjmhesphhusgdrphhinhhkpd hnsggprhgtphhtthhopeehpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopeejledt geejseguvggssghughhsrdhgnhhurdhorhhgpdhrtghpthhtohepmhhonhhnihgvrhesih hrohdruhhmohhnthhrvggrlhdrtggrpdhrtghpthhtoheprggtmhesmhhutgdruggvpdhr tghpthhtohepvghgieegvdeiudeisehgmhgrihhlrdgtohhmpdhrtghpthhtohepvghlih iisehgnhhurdhorhhg X-ME-Proxy: Feedback-ID: i74194916:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 19 Jul 2025 14:51:49 -0400 (EDT) From: john muhl To: Eli Zaretskii Subject: Re: bug#79047: Add some multi-character pairs to some major modes. In-Reply-To: <867c04fzpv.fsf@gnu.org> References: <87ms91gcmb.fsf@gmail.com> <867c04fzpv.fsf@gnu.org> Date: Sat, 19 Jul 2025 13:51:39 -0500 Message-ID: <87o6tgko90.fsf@pub.pink> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 79047 Cc: 79047@debbugs.gnu.org, Alan Mackenzie , Elijah Gabe =?utf-8?Q?P=C3=A9rez?= , Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Eli Zaretskii writes: >> From: Elijah Gabe P=C3=A9rez >> Date: Fri, 18 Jul 2025 20:04:12 -0600 >>=20 >> Since `electric-pair-mode` now supports multi-character pairs, it would >> be better if some major modes add some of these pairs. >>=20 >> Before making the patch for this (and to avoid doing another regression >> like bug#77823), here is a list of the modes and their possible pairs: >>=20 >> - c-like modes >> "/*" "*/" >> - lua-ts-mode >> "--[" "--]" >> - texinfo-mode (idk which others one) (based in a Stefan Monnier idea) >> "``" "''" >> - lisp-mode (common-lisp-mode) >> "#|" "|#" >>=20 >> What do you think? > > When discussing in a bug report issues related to some specific > packages, it is usually a good idea to CC the authors/developers of > those packages, because we cannot be sure they track the bug-gnu-emacs > list all the time. > > I've now added people who I think are relevant to your proposal. > > Thanks. I=E2=80=99m not sure what the question is here but in general if someone fi= nds something useful to add to lua-ts-mode I=E2=80=99m fine with it; especially= if it comes with tests for the change. Just reading the above I=E2=80=99d point out that Lua multi-line comments a= ren=E2=80=99t symmetrical: --[[ Here is a very long comment. ]] and electric-pair-mode already works in that case. Some people like to add a second pair of dashes before the closing brackets but they are stylistic, not a requirement. Elijah, if I missed the point then maybe you could show the proposed patch to lua-ts-mode. Thanks. From debbugs-submit-bounces@debbugs.gnu.org Sun Jul 20 07:30:16 2025 Received: (at 79047) by debbugs.gnu.org; 20 Jul 2025 11:30:16 +0000 Received: from localhost ([127.0.0.1]:49250 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1udSFD-0006oE-RQ for submit@debbugs.gnu.org; Sun, 20 Jul 2025 07:30:16 -0400 Received: from mail.muc.de ([193.149.48.3]:23093) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1udSFB-0006Kt-Bz for 79047@debbugs.gnu.org; Sun, 20 Jul 2025 07:30:13 -0400 Received: (qmail 9955 invoked by uid 3782); 20 Jul 2025 13:30:05 +0200 Received: from muc.de (p4fe152fa.dip0.t-ipconnect.de [79.225.82.250]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Sun, 20 Jul 2025 13:30:05 +0200 Received: (qmail 8388 invoked by uid 1000); 20 Jul 2025 11:30:04 -0000 Date: Sun, 20 Jul 2025 11:30:04 +0000 To: Elijah Gabe =?iso-8859-1?Q?P=E9rez?= Subject: Re: bug#79047: Add some multi-character pairs to some major modes. Message-ID: References: <87ms91gcmb.fsf@gmail.com> <867c04fzpv.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <867c04fzpv.fsf@gnu.org> X-Submission-Agent: TMDA/1.3.x (Ph3nix) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 79047 Cc: 79047@debbugs.gnu.org, acm@muc.de, Eli Zaretskii , John Muhl , Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello, Elijah. One important point. On Sat, Jul 19, 2025 at 09:42:52 +0300, Eli Zaretskii wrote: > > From: Elijah Gabe Pérez > > Date: Fri, 18 Jul 2025 20:04:12 -0600 > > Since `electric-pair-mode` now supports multi-character pairs, it would > > be better if some major modes add some of these pairs. Are you sure about this? In NEWS, there is the rather sloppily worded entry: ** 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. It uses the sloppy American English ambiguity where "multiple" can mean either "several", or "composed of several parts". In correct British English "multiple" has only the latter meaning. I think in this NEWS entry the meaning "several" was intended, and you may have misread it. I don't think electric-pair-mode has any facilities for pairing a multiple delimiter; only for pairing several of the same delimiter at once, e.g. (((....))). Please check if I am correct or mistaken on this point. If I'm correct, then the prerequisites for implementing this change are absent, and there is nothing more to discuss. > > Before making the patch for this (and to avoid doing another regression > > like bug#77823), here is a list of the modes and their possible pairs: [ .... ] -- Alan Mackenzie (Nuremberg, Germany). From debbugs-submit-bounces@debbugs.gnu.org Tue Jul 22 19:03:52 2025 Received: (at 79047) by debbugs.gnu.org; 22 Jul 2025 23:03:53 +0000 Received: from localhost ([127.0.0.1]:46202 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ueM1U-0001tY-Iq for submit@debbugs.gnu.org; Tue, 22 Jul 2025 19:03:51 -0400 Received: from mail-oi1-x241.google.com ([2607:f8b0:4864:20::241]:49447) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1ueM1P-0001sr-Nv for 79047@debbugs.gnu.org; Tue, 22 Jul 2025 19:03:45 -0400 Received: by mail-oi1-x241.google.com with SMTP id 5614622812f47-41b4ebb15e2so2861004b6e.3 for <79047@debbugs.gnu.org>; Tue, 22 Jul 2025 16:03:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1753225418; x=1753830218; darn=debbugs.gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=FM6XaN1NgxtrBSovM5cjiKMKSRyLPa3n7tz+mobMlfI=; b=mxtnm5D9W/RxZM29sdFb3ZgRmaHnpLQkwV3U/FdGKRdnp+S4A1nin/hJ1dJtcL0+HY xAamZX+vWbSG7/QvYFJU8vQLh9PA+wTE2X06z0w9LeJ4yyq3r40EJergp+UBiRzQCQlg yF71Prx90lmtvtYYQCgzUtd2Yxoo65AAgAeuQ1eX4CG889pQC2fgMVQKpxAJvL89N/X7 qTvlYmfvZDWgY0qicPcXji042lj0oKfV9SYhkwpPpJnl6oPE3ZjzD5ffvsWPRGpanHm/ +aRWe+XIUZr1P1TjnAE0agu/CEKbxiROaj7B+7WOlAGp9HZ2Ty6iMtM38Ns3BDe+j4k5 KAdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753225418; x=1753830218; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=FM6XaN1NgxtrBSovM5cjiKMKSRyLPa3n7tz+mobMlfI=; b=RQkFuYlnjMgGvts7NaHSVcj0U/SLRi/2DfUuMNlUtsu9o0vCEmRZWb0mjaXVVdyVF/ Vp+aEOqJDz/zprgI2J5xM4b8u+NHHrdPViQvDH1AFwTe83f6plrRnR01RtFQ+8dmvsdh eovXpRTmgR54FESH3+ExxEKzSv7hP9k88wzdIvstcnrmn9nnipHaV+HhEbXu9fcwQPNX WgLJaGK8+aiVD6YW3skKtG1iyQBQIT/Vq9b56wFICunri610iGd3wSne4Lr/rf+Vj1N9 3wO/wuJbUjwjk69n4Oi9pq1z+Y9FrZOvRtz9zoAIGDQdHV1QoaqDBZUuoJCysxS3s3Ta tRiA== X-Gm-Message-State: AOJu0YxP4XZL2voxl9bWU6gVRpaGSHRLdysvuUwfQWv9q4s2nsdqMN7O lcQYM3PJTsCo7vEecRM6m0az+qjdonYon/C1602oZFMM/f+nwl8plHhU X-Gm-Gg: ASbGncvQBTbnJpn41XVO69i0z592E26K97Qz21QcnT635IKl2PEMedpJEoNubb2RTPW JRvxlG4OjEuH4CEmOzdau0W2PmF4IZcH4U/rPc0JbeQuacWtb+rviUVbAS6T1ZSaHKzKk8KVpR1 BjoCF/Rv2nKnN1Mtrhj8Wra9YjE6VIC+bWNbIL+u1VBrKpulfatfnUGrML48UkmY+TG33ArRyDr 34Wv1XUJgu1Sf2TO8U6ruUi65+reBqYoHpTsmGlAvj/x9bbnm11qxu0HrICpzJL2N+7Zgbrxp4a Vog49H/iniSfrlTolmvU5Jev9ZVt/B8XN5KF4QgO5Qt6Fvr9EGhHoFQYy8u390hWDjwweU6V8zK oFzLWBf1DV8HB0Ms= X-Google-Smtp-Source: AGHT+IHZE4HLekC194T+bmi/n/sxAlxrA9z5F5wJ2scyneuBI7LFQn5ytVuBBhnA0kfwqz4gRnjqGA== X-Received: by 2002:a05:6808:4f51:b0:426:9d0c:2d81 with SMTP id 5614622812f47-426c6438abdmr686240b6e.27.1753225417835; Tue, 22 Jul 2025 16:03:37 -0700 (PDT) Received: from fedora ([189.215.162.117]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-615bcc8e42fsm2123882eaf.22.2025.07.22.16.03.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Jul 2025 16:03:37 -0700 (PDT) From: =?utf-8?Q?Elijah_Gabe_P=C3=A9rez?= To: Alan Mackenzie Subject: Re: bug#79047: Add some multi-character pairs to some major modes. In-Reply-To: References: <87ms91gcmb.fsf@gmail.com> <867c04fzpv.fsf@gnu.org> Date: Tue, 22 Jul 2025 17:03:34 -0600 Message-ID: <87ecu7vneh.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 79047 Cc: 79047@debbugs.gnu.org, Eli Zaretskii , John Muhl , Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Alan Mackenzie writes: > Hello, Elijah. > > One important point. > > Are you sure about this? In NEWS, there is the rather sloppily worded > entry: > > ** 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. > > It uses the sloppy American English ambiguity where "multiple" can mean > either "several", or "composed of several parts". In correct British > English "multiple" has only the latter meaning. > > I think in this NEWS entry the meaning "several" was intended, and you > may have misread it. I don't think electric-pair-mode has any facilities > for pairing a multiple delimiter; only for pairing several of the same > delimiter at once, e.g. (((....))). That is the wrong NEWS entry of the feature. The real one is this: *** Electric Pair mode now supports multi-character paired delimiters. 'electric-pair-pairs' and 'electric-pair-text-pairs' now allow using strings for multi-character paired delimiters. To use this, add a list to both electric pair user options: '("/*" . "*/")'. You can also specify to insert an extra space after the first string pair: '("/*" " */" t)'. > Please check if I am correct or mistaken on this point. If I'm correct, > then the prerequisites for implementing this change are absent, and there > is nothing more to discuss. I've tested the feature, it's possible to achieve it: (setq electric-pair-pairs `((,(regexp-quote "/*") " */" t))) /* | */ ^^ After inserting the * character. (the extra whitespace is optionally included) -- - E.G via GNU Emacs and Org. From debbugs-submit-bounces@debbugs.gnu.org Thu Jul 24 09:39:28 2025 Received: (at 79047) by debbugs.gnu.org; 24 Jul 2025 13:39:28 +0000 Received: from localhost ([127.0.0.1]:55725 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uewAR-0002Kc-Nu for submit@debbugs.gnu.org; Thu, 24 Jul 2025 09:39:28 -0400 Received: from mail.muc.de ([193.149.48.3]:47954) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uewAN-0002K8-EJ for 79047@debbugs.gnu.org; Thu, 24 Jul 2025 09:39:25 -0400 Received: (qmail 21926 invoked by uid 3782); 24 Jul 2025 15:39:17 +0200 Received: from muc.de (p4fe15d15.dip0.t-ipconnect.de [79.225.93.21]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Thu, 24 Jul 2025 15:39:16 +0200 Received: (qmail 11089 invoked by uid 1000); 24 Jul 2025 13:39:16 -0000 Date: Thu, 24 Jul 2025 13:39:16 +0000 To: Elijah Gabe =?iso-8859-1?Q?P=E9rez?= Subject: Re: bug#79047: Add some multi-character pairs to some major modes. Message-ID: References: <87ms91gcmb.fsf@gmail.com> <867c04fzpv.fsf@gnu.org> <87ecu7vneh.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <87ecu7vneh.fsf@gmail.com> X-Submission-Agent: TMDA/1.3.x (Ph3nix) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 79047 Cc: 79047@debbugs.gnu.org, Eli Zaretskii , John Muhl , Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello Elijah. On Tue, Jul 22, 2025 at 17:03:34 -0600, Elijah Gabe Pérez wrote: > Alan Mackenzie writes: [ .... ] > > Are you sure about this? .... [ .... ] > That is the wrong NEWS entry of the feature. > The real one is this: > *** Electric Pair mode now supports multi-character paired delimiters. > 'electric-pair-pairs' and 'electric-pair-text-pairs' now allow using > strings for multi-character paired delimiters. Apologies. I missed this one, somehow. This NEWS entry is part of commit 60fbeda771639ded68ffd0666df340c7a06cafcf Author: Elías Gabriel Pérez Date: Thu Apr 24 17:34:58 2025 -0600 Support strings for electric pairs (bug#78053) .. This commit appears to me to be incomplete. In particular: (i) The doc string of electric-pair-syntax-info hasn't been modified to reflect the result component SYNTAX possibly being the symbol `str'. (ii) The insertion of string pairs at ~L692 in electric-pair-post-self-insert-function neglects to check electric-pair-inhibit-predicate. It's unclear why this isn't done, but if there's a good reason it should be documented somewhere (if it isn't already; I haven't actually checked). e-p-inhibit-predicate gets used, and not handling it makes the insertion of string pairs inconsistent with the rest of electric-pair mode and less useful. (iii) I don't think you've documented anywhere that the first string in an entry in electric-pair-pairs is actually a regular expression. (Again, I haven't rigorously searched for such documentation.) > To use this, add a list to both electric pair user options: '("/*" . "*/")'. > You can also specify to insert an extra space after the first string > pair: '("/*" " */" t)'. [ .... ] > I've tested the feature, it's possible to achieve it: [ .... ] Yes, sort of. But electric pair mode's implementation violates an (unwritten) Emacs convention about hooks, i.e. that a hook function doesn't mess with the functionality that invoked it. For example, a function in window-scroll-functions may not change the scrolling state of a window, and an after-change-functions function never changes the text of a buffer. By contrast, electric-pair-post-self-insert-function does mess with the invoking functionality, namely self-insert-command; it inserts further characters. From the point of view of a Lisp program, this makes self-insert-function an undefined function - what it does varies from time to time and from buffer to buffer. CC Mode has had to implement a workaround for this, namely binding post-self-insert-function to nil (to get defined functionality for self-insert-command), then later calling electric-pair-post-self-insert-function by hand, to get the electric pair functionality. It's ugly and anything but robust. So, yes, it is possible to get the functionality in CC Mode with ("/\\*" " */" t), but it is not entirely trivial. > -- > - E.G via GNU Emacs and Org. -- Alan Mackenzie (Nuremberg, Germany). From debbugs-submit-bounces@debbugs.gnu.org Thu Jul 24 10:54:08 2025 Received: (at 79047) by debbugs.gnu.org; 24 Jul 2025 14:54:08 +0000 Received: from localhost ([127.0.0.1]:57446 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uexKh-0007zY-H8 for submit@debbugs.gnu.org; Thu, 24 Jul 2025 10:54:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58704) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uexKf-0007yC-CU for 79047@debbugs.gnu.org; Thu, 24 Jul 2025 10:54:06 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uexKY-0004sX-NU; Thu, 24 Jul 2025 10:53:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=7jw0LCDRGp3No6ur9RCEaStj60tmhi7XVvQKj2F1uxY=; b=Cp/qYR7wlHmW qGPQ1RrUuVG7s9PemCLdxveXYTlhyn95wo/nPd2TVoXR9qEq+E4demZ2SQ/IK0v2b46fH0Dvri6dQ zWmGAV8hgFzMxFJRZIvpMtM24gntHSwj1Fox5OFze1aqEEnfzKF9OttlyKmTscr8l8xvCwIqSQKUB Y/2wumu/wZ39UfeNJhkHa5ZRnq2E1cOY+EKfDqc2n352QSeJMsNrjNJdy+3w9Bd6sVtBg8f9CO9eJ Hpi61qZvBK3ktfvoRVMY2YcxU6svAFBVMBsyz2b1gRh71dj36sJ6AojkX4nImak9ChTFbuLED2djH NRXQ8XoDBkxXEkDixPvgNA==; Date: Thu, 24 Jul 2025 17:53:55 +0300 Message-Id: <86ecu563ng.fsf@gnu.org> From: Eli Zaretskii To: Alan Mackenzie In-Reply-To: (message from Alan Mackenzie on Thu, 24 Jul 2025 13:39:16 +0000) Subject: Re: bug#79047: Add some multi-character pairs to some major modes. References: <87ms91gcmb.fsf@gmail.com> <867c04fzpv.fsf@gnu.org> <87ecu7vneh.fsf@gmail.com> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 79047 Cc: 79047@debbugs.gnu.org, eg642616@gmail.com, jm@pub.pink, monnier@iro.umontreal.ca X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Thu, 24 Jul 2025 13:39:16 +0000 > Cc: 79047@debbugs.gnu.org, Eli Zaretskii , > John Muhl , Stefan Monnier > From: Alan Mackenzie > > Yes, sort of. But electric pair mode's implementation violates an > (unwritten) Emacs convention about hooks, i.e. that a hook function > doesn't mess with the functionality that invoked it. For example, a > function in window-scroll-functions may not change the scrolling state of > a window, and an after-change-functions function never changes the text > of a buffer. > > By contrast, electric-pair-post-self-insert-function does mess with the > invoking functionality, namely self-insert-command; it inserts further > characters. From the point of view of a Lisp program, this makes > self-insert-function an undefined function - what it does varies from > time to time and from buffer to buffer. ?? post-self-insert-hook is specifically mean for features that insert additional characters, or even replace characters by others. Otherwise, what would that hook be good for? The ELisp manual says about this: "You could use this to automatically reindent text as it is typed, for example." And what is reindentation if not removal of some characters and insertion of others? So I don't understand the nature of your dislike in this case. From debbugs-submit-bounces@debbugs.gnu.org Thu Jul 24 11:54:27 2025 Received: (at 79047) by debbugs.gnu.org; 24 Jul 2025 15:54:27 +0000 Received: from localhost ([127.0.0.1]:57773 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ueyH4-00071v-Qo for submit@debbugs.gnu.org; Thu, 24 Jul 2025 11:54:27 -0400 Received: from mail.muc.de ([193.149.48.3]:41153) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ueyH0-00071L-VT for 79047@debbugs.gnu.org; Thu, 24 Jul 2025 11:54:25 -0400 Received: (qmail 85483 invoked by uid 3782); 24 Jul 2025 17:54:15 +0200 Received: from muc.de (p4fe15d15.dip0.t-ipconnect.de [79.225.93.21]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Thu, 24 Jul 2025 17:54:15 +0200 Received: (qmail 14175 invoked by uid 1000); 24 Jul 2025 15:54:14 -0000 Date: Thu, 24 Jul 2025 15:54:14 +0000 To: Eli Zaretskii Subject: Re: bug#79047: Add some multi-character pairs to some major modes. Message-ID: References: <87ms91gcmb.fsf@gmail.com> <867c04fzpv.fsf@gnu.org> <87ecu7vneh.fsf@gmail.com> <86ecu563ng.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <86ecu563ng.fsf@gnu.org> X-Submission-Agent: TMDA/1.3.x (Ph3nix) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 79047 Cc: 79047@debbugs.gnu.org, acm@muc.de, eg642616@gmail.com, jm@pub.pink, monnier@iro.umontreal.ca X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello, Eli. On Thu, Jul 24, 2025 at 17:53:55 +0300, Eli Zaretskii wrote: > > Date: Thu, 24 Jul 2025 13:39:16 +0000 > > Cc: 79047@debbugs.gnu.org, Eli Zaretskii , > > John Muhl , Stefan Monnier > > From: Alan Mackenzie > > Yes, sort of. But electric pair mode's implementation violates an > > (unwritten) Emacs convention about hooks, i.e. that a hook function > > doesn't mess with the functionality that invoked it. For example, a > > function in window-scroll-functions may not change the scrolling state of > > a window, and an after-change-functions function never changes the text > > of a buffer. > > By contrast, electric-pair-post-self-insert-function does mess with the > > invoking functionality, namely self-insert-command; it inserts further > > characters. From the point of view of a Lisp program, this makes > > self-insert-function an undefined function - what it does varies from > > time to time and from buffer to buffer. > ?? post-self-insert-hook is specifically mean for features that insert > additional characters, or even replace characters by others. > Otherwise, what would that hook be good for? Nothing, as far as I can see. I see no legitimate need for that hook. > The ELisp manual says about this: "You could use this to automatically > reindent text as it is typed, for example." And what is reindentation > if not removal of some characters and insertion of others? > So I don't understand the nature of your dislike in this case. I'll start off with the abstract: It breaks the abstraction mentioned in my first paragraph above that hook functions do things ancillary to the main function, and do not constitute part of it. So that, for example, in an after-change-functions function, you know that no deletion by a previous a-c-f will have made the START, END, and OLD-LEN arguments invalid. This principle holds for all hook uses I'm aware of except for post-self-insert-function. It enables Lisp coding to be done sensibly without having to program around all the "what if"s which would arise by people programming buffer changes into a-c-f's, or amending the scrolling inside a window-scroll-functions function for example. Now the concrete: c-electric-paren, for example, does EOL cleanups after inserting the ?\( the user typed using self-insert-command - this involves detecting that the newly inserted ?\( is at EOL (modulo whitespace). This breaks when electric-pair-post-self-insert-function (or anything else on that hook) inserts further characters after the one the user has typed. As a workaround, I bind post-self-insert-hook to nil around the call to self-insert-command, this being the only way I know to get predictable functionality from self-insert-command. Later I have to call electric-pair-post-self-insert-function explicitly from c-electric-paren. This is neither robust nor future proof. The error here is that post-self-insert-hook is invoked from the middle of the command using self-insert-function, rather than after its end. One way of fixing this would be to put electric-pair-post-self-insert-function on post-command-hook instead. -- Alan Mackenzie (Nuremberg, Germany). From debbugs-submit-bounces@debbugs.gnu.org Thu Jul 24 13:02:25 2025 Received: (at 79047) by debbugs.gnu.org; 24 Jul 2025 17:02:25 +0000 Received: from localhost ([127.0.0.1]:58055 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uezKr-0003R2-4u for submit@debbugs.gnu.org; Thu, 24 Jul 2025 13:02:25 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:46238) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uezKn-0003Qg-Lx for 79047@debbugs.gnu.org; Thu, 24 Jul 2025 13:02:22 -0400 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 42DF810013E; Thu, 24 Jul 2025 13:02:16 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1753376534; bh=lm14olRn/nuJPayZ6zZbxvRJr9Xd0yVHWoa773ljhiU=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=NmfotPmFMfT27v8+VabhfunQRYy6YOp108gYLMoV34Wep4omZ4SYXNSZtpq2xX19U 9/sEYOZIwUtLpRG1xaeQT5CVGIWtbbeZk7n++2XsswgpIqhbM/vZ3hYmNjd2V1CDmP rhbK79Q1baqHUX195lUvPUlZRC6C1UshdK+1AIyg1S/LDTvYZKNK754GNDgP9NQsp6 4341tAMjH80+8yfUDDG8AhzCs6lxWhOh7hA+nUex0QgsexAfgiOYIFrJXyzpN8F4Ff UArKcfV3p4M8z7FMhrAezFpBFbjxDZguXnYk6IzbP62ETqei0PXgc2ySxt0WEvasGg jGGcEgX1m0AyA== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 8656A10002E; Thu, 24 Jul 2025 13:02:14 -0400 (EDT) Received: from pastel (unknown [104.247.225.139]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 4E412120346; Thu, 24 Jul 2025 13:02:14 -0400 (EDT) From: Stefan Monnier To: Alan Mackenzie Subject: Re: bug#79047: Add some multi-character pairs to some major modes. In-Reply-To: Message-ID: References: <87ms91gcmb.fsf@gmail.com> <867c04fzpv.fsf@gnu.org> <87ecu7vneh.fsf@gmail.com> <86ecu563ng.fsf@gnu.org> Date: Thu, 24 Jul 2025 13:02:13 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.263 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 79047 Cc: 79047@debbugs.gnu.org, Eli Zaretskii , jm@pub.pink, eg642616@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > As a workaround, I bind post-self-insert-hook to nil around the call to > self-insert-command, this being the only way I know to get predictable > functionality from self-insert-command. "predictable functionality" and `self-insert-command` don't get along very well, I'm afraid (e.g. because of `auto-fill-chars` and abbrev expansion). Part of the problem is fundamental, I think: when several forms of electricity want to affect the same key, there is inevitably some delicate issues that require them to cooperate to some extent. It's hard to make them work together peacefully *and* modularily at the same time. > The error here is that post-self-insert-hook is invoked from the middle > of the command using self-insert-function, rather than after its end. > One way of fixing this would be to put > electric-pair-post-self-insert-function on post-command-hook instead. That tends to move the problem: it would be your code which risks breaking the others, rather than other way around. I don't have a solution which I would call "good", but the best we have so far is to get rid of the `c-electric-paren` command and turn it into a hook added to `post-self-insert-hook` instead. This will let you use the DEPTH argument of `add-hook` to control when it is run w.r.t to the other hooks. That's what the other `electric-FOO-mode` do to cohabit. Stefan From debbugs-submit-bounces@debbugs.gnu.org Thu Jul 24 14:47:35 2025 Received: (at 79047) by debbugs.gnu.org; 24 Jul 2025 18:47:35 +0000 Received: from localhost ([127.0.0.1]:58427 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uf0yc-00027w-L4 for submit@debbugs.gnu.org; Thu, 24 Jul 2025 14:47:34 -0400 Received: from mail.muc.de ([193.149.48.3]:46254) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uf0ya-00027X-H0 for 79047@debbugs.gnu.org; Thu, 24 Jul 2025 14:47:33 -0400 Received: (qmail 95098 invoked by uid 3782); 24 Jul 2025 20:47:25 +0200 Received: from muc.de (p4fe15d15.dip0.t-ipconnect.de [79.225.93.21]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Thu, 24 Jul 2025 20:47:25 +0200 Received: (qmail 11379 invoked by uid 1000); 24 Jul 2025 18:47:25 -0000 Date: Thu, 24 Jul 2025 18:47:24 +0000 To: Stefan Monnier Subject: Re: bug#79047: Add some multi-character pairs to some major modes. Message-ID: References: <87ms91gcmb.fsf@gmail.com> <867c04fzpv.fsf@gnu.org> <87ecu7vneh.fsf@gmail.com> <86ecu563ng.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Submission-Agent: TMDA/1.3.x (Ph3nix) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 79047 Cc: 79047@debbugs.gnu.org, acm@muc.de, Eli Zaretskii , jm@pub.pink, eg642616@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello, Stefan. Thanks for your reply. Sadly you snipped the key section of my last post. Here it is again: > > But electric pair mode's implementation violates an (unwritten) Emacs > > convention about hooks, i.e. that a hook function doesn't mess with > > the functionality that invoked it. For example, a function in > > window-scroll-functions may not change the scrolling state of a > > window, and an after-change-functions function never changes the text > > of a buffer. > > By contrast, electric-pair-post-self-insert-function does mess with > > the invoking functionality, namely self-insert-command; it inserts > > further characters. From the point of view of a Lisp program, this > > makes self-insert-function an undefined function - what it does > > varies from time to time and from buffer to buffer. As you're aware, when faced with a problem, I tend to analyse the cause at the appropriately abstract level, and then fix that cause, rather than just paper over the problem with some unsatisfactory workaround. The fundamental cause of this problem with electric pair mode is, I believe, in my two quoted paragraphs above. I ask you to answer the points made in these two paragraphs. Thanks! > Stefan -- Alan Mackenzie (Nuremberg, Germany). From debbugs-submit-bounces@debbugs.gnu.org Thu Jul 24 16:45:37 2025 Received: (at 79047) by debbugs.gnu.org; 24 Jul 2025 20:45:37 +0000 Received: from localhost ([127.0.0.1]:58808 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uf2or-0001ie-JG for submit@debbugs.gnu.org; Thu, 24 Jul 2025 16:45:37 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:55863) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uf2op-0001hv-Jj for 79047@debbugs.gnu.org; Thu, 24 Jul 2025 16:45:36 -0400 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id F02B810013E; Thu, 24 Jul 2025 16:45:29 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1753389929; bh=Nh1ecUyCyLV4y0yKM/2CB1la48+w+84NeE2VFudlUqs=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=FXGTorzJm/GJhhJulKvyvjqimI5274NN3+UdxNh/2Y7CCXK3X0yn3uCDP+kliRu4h pSA9+vdNswyG5gS2wstxrDGuvKcY7ghdeD5SDBn/z1QAbZ8mSo6jbF8P92FQIqlU2v 0bIOh0k1Tv1x9KzY92IdScdhdD2N1TyTPtOzbSmZCWRNpZCvl90T33K1z09HBQw7LY g8cWlBHqmAK8jASdvq7/hv1ZUyKSMT5cq0/j5HcShtIJc9SQEJCf54knlaNjKoNlF1 ecE8OVjmMoz10A9JFg1ir/ynJlipLFc5FBY5ETPbZe07I7hSdDRFLVvrEXias+Qvz3 mK+EH+vEn6/5w== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 049D910002E; Thu, 24 Jul 2025 16:45:29 -0400 (EDT) Received: from alfajor (unknown [204.48.90.96]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 87E7A120342; Thu, 24 Jul 2025 16:45:28 -0400 (EDT) From: Stefan Monnier To: Alan Mackenzie Subject: Re: bug#79047: Add some multi-character pairs to some major modes. In-Reply-To: Message-ID: References: <87ms91gcmb.fsf@gmail.com> <867c04fzpv.fsf@gnu.org> <87ecu7vneh.fsf@gmail.com> <86ecu563ng.fsf@gnu.org> Date: Thu, 24 Jul 2025 16:45:27 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 79047 Cc: 79047@debbugs.gnu.org, Eli Zaretskii , jm@pub.pink, eg642616@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > The fundamental cause of this problem with electric pair mode is, I > believe, in my two quoted paragraphs above. I ask you to answer the > points made in these two paragraphs. I understand it to mean that the problem is philosophical. That's fine, but I don't see how it helps us address the concrete issue. For that reason I did not have anything to say about those two paragraphs. Stefan From debbugs-submit-bounces@debbugs.gnu.org Fri Jul 25 02:53:21 2025 Received: (at 79047) by debbugs.gnu.org; 25 Jul 2025 06:53:21 +0000 Received: from localhost ([127.0.0.1]:60707 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ufCIy-0000nW-Tc for submit@debbugs.gnu.org; Fri, 25 Jul 2025 02:53:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39484) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ufCIs-0000n0-Tu for 79047@debbugs.gnu.org; Fri, 25 Jul 2025 02:53:18 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ufCIl-0007en-Fb; Fri, 25 Jul 2025 02:53:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=2JydeN0kxRWfEx47+hqEK6IALbatCWlXAwU0dILPhAM=; b=quzyNKxZ5WWE hJtTtkezWLyjybqHTJHbenB4VeG+KFoiTPsOP12q8j0nfBs3SaLYk2RMS5nyuDu9Zc2pGcXgJhuYU z0qyhwyBQcSv4wrl457O3SkgXTpKn5cEbTAUYyZN1/xhSXsspwzwKvKJCdMX6khtkBIJNRJCyfKNp uF/ylnp4oZilIqunt1Fj/KNu/tj99KfOO8kx81DF90Yzh+FkJT/gwlfgRmp1BUI3OdcRhrK3Vr8Hx zF+sRfOsXx/7ypCXJA0iTzyqyc3uJU53DAXp9UtFMaez2Ybv68zd+TfCLc9vqG5yERm0cUmD7RfKr FYv6c2yXk7Bawc2aOy61eQ==; Date: Fri, 25 Jul 2025 09:53:03 +0300 Message-Id: <8634ak69tc.fsf@gnu.org> From: Eli Zaretskii To: Alan Mackenzie In-Reply-To: (message from Alan Mackenzie on Thu, 24 Jul 2025 18:47:24 +0000) Subject: Re: bug#79047: Add some multi-character pairs to some major modes. References: <87ms91gcmb.fsf@gmail.com> <867c04fzpv.fsf@gnu.org> <87ecu7vneh.fsf@gmail.com> <86ecu563ng.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 79047 Cc: 79047@debbugs.gnu.org, acm@muc.de, eg642616@gmail.com, jm@pub.pink, monnier@iro.umontreal.ca X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Thu, 24 Jul 2025 18:47:24 +0000 > Cc: Eli Zaretskii , eg642616@gmail.com, 79047@debbugs.gnu.org, > jm@pub.pink, acm@muc.de > From: Alan Mackenzie > > > > But electric pair mode's implementation violates an (unwritten) Emacs > > > convention about hooks, i.e. that a hook function doesn't mess with > > > the functionality that invoked it. For example, a function in > > > window-scroll-functions may not change the scrolling state of a > > > window, and an after-change-functions function never changes the text > > > of a buffer. > > > > By contrast, electric-pair-post-self-insert-function does mess with > > > the invoking functionality, namely self-insert-command; it inserts > > > further characters. From the point of view of a Lisp program, this > > > makes self-insert-function an undefined function - what it does > > > varies from time to time and from buffer to buffer. > > As you're aware, when faced with a problem, I tend to analyse the cause > at the appropriately abstract level, and then fix that cause, rather than > just paper over the problem with some unsatisfactory workaround. > > The fundamental cause of this problem with electric pair mode is, I > believe, in my two quoted paragraphs above. I ask you to answer the > points made in these two paragraphs. And as I already mention, you perceive a convention where there is none. Thus electric-pair-mode doesn't violate any conventions. From debbugs-submit-bounces@debbugs.gnu.org Fri Jul 25 06:32:26 2025 Received: (at 79047) by debbugs.gnu.org; 25 Jul 2025 10:32:26 +0000 Received: from localhost ([127.0.0.1]:33182 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ufFiz-00078M-MT for submit@debbugs.gnu.org; Fri, 25 Jul 2025 06:32:26 -0400 Received: from mail.muc.de ([193.149.48.3]:41591) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ufFix-00077o-B5 for 79047@debbugs.gnu.org; Fri, 25 Jul 2025 06:32:24 -0400 Received: (qmail 61909 invoked by uid 3782); 25 Jul 2025 12:32:16 +0200 Received: from muc.de (pd953aea1.dip0.t-ipconnect.de [217.83.174.161]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Fri, 25 Jul 2025 12:32:16 +0200 Received: (qmail 4275 invoked by uid 1000); 25 Jul 2025 10:32:15 -0000 Date: Fri, 25 Jul 2025 10:32:15 +0000 To: Eli Zaretskii Subject: Re: bug#79047: Add some multi-character pairs to some major modes. Message-ID: References: <87ms91gcmb.fsf@gmail.com> <867c04fzpv.fsf@gnu.org> <87ecu7vneh.fsf@gmail.com> <86ecu563ng.fsf@gnu.org> <8634ak69tc.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8634ak69tc.fsf@gnu.org> X-Submission-Agent: TMDA/1.3.x (Ph3nix) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 79047 Cc: 79047@debbugs.gnu.org, acm@muc.de, eg642616@gmail.com, jm@pub.pink, monnier@iro.umontreal.ca X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello, Eli. On Fri, Jul 25, 2025 at 09:53:03 +0300, Eli Zaretskii wrote: > > Date: Thu, 24 Jul 2025 18:47:24 +0000 > > Cc: Eli Zaretskii , eg642616@gmail.com, 79047@debbugs.gnu.org, > > jm@pub.pink, acm@muc.de > > From: Alan Mackenzie > > > > But electric pair mode's implementation violates an (unwritten) Emacs > > > > convention about hooks, i.e. that a hook function doesn't mess with > > > > the functionality that invoked it. For example, a function in > > > > window-scroll-functions may not change the scrolling state of a > > > > window, and an after-change-functions function never changes the text > > > > of a buffer. > > > > By contrast, electric-pair-post-self-insert-function does mess with > > > > the invoking functionality, namely self-insert-command; it inserts > > > > further characters. From the point of view of a Lisp program, this > > > > makes self-insert-function an undefined function - what it does > > > > varies from time to time and from buffer to buffer. > > As you're aware, when faced with a problem, I tend to analyse the cause > > at the appropriately abstract level, and then fix that cause, rather than > > just paper over the problem with some unsatisfactory workaround. > > The fundamental cause of this problem with electric pair mode is, I > > believe, in my two quoted paragraphs above. I ask you to answer the > > points made in these two paragraphs. > And as I already mention, you perceive a convention where there is > none. OK, then, Emacs hackers have abided by this non-convention nevertheless, out of instinctive good sense and good taste. Up until post-self-insert-hook. > Thus electric-pair-mode doesn't violate any conventions. self-insert-command, called from Lisp, is broken. There is no usable definition of its functionality. So far, there is no competing analysis to mine as to how it's broken. Stefan's "solution" is not to use self-insert-command. This is impractical for c-electric-paren and friends. Incidentally there are around 122 uses of self-insert-command in Emacs. So it's looking like the ugly workarounds in c-electric-paren to use self-insert-command will have to remain. I'm disappointed about this. -- Alan Mackenzie (Nuremberg, Germany). From debbugs-submit-bounces@debbugs.gnu.org Fri Jul 25 07:08:57 2025 Received: (at 79047) by debbugs.gnu.org; 25 Jul 2025 11:08:57 +0000 Received: from localhost ([127.0.0.1]:33322 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ufGIK-00019W-VE for submit@debbugs.gnu.org; Fri, 25 Jul 2025 07:08:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40994) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ufGIH-00018x-Os for 79047@debbugs.gnu.org; Fri, 25 Jul 2025 07:08:54 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ufGIA-00075m-Us; Fri, 25 Jul 2025 07:08:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=B8x5V1/5Wj/16f4qmviVvQiYZ4QK8TTEyAvebBxMxgw=; b=Q2y0S0yDnu+Z cmRO1ETpB1m2ebb50PrgOOxWj9unKnRuNS8dJNSwvU2J21b/LjApUHHIt/uFf9XHCnBMs4sjNnMxx HGjA5jhrUiBAyhyk+m7OkoT3EgHpVG0zaVcDX/Dz0QAOscCfwXChqTNNzSkWMebBwOR+LPBhDxSwC 7Ghl6PAJI2RoPwgQcxLwiH8+erTIDISqkMz/7r7t8Lq+CYGoV2Yu3gp7xFeH7JeibFtMG2+2h7Nc5 CdB1UjCrFJ5qB1uz6yuEYoBx4WeXzcrU244Z77W4f7OVXs2aVk2lszJfRmTIIV3wTmxGPZthYy8HL 3jzL93lXN7+4/k0TUGGIgg==; Date: Fri, 25 Jul 2025 14:08:43 +0300 Message-Id: <86v7ng4jes.fsf@gnu.org> From: Eli Zaretskii To: Alan Mackenzie In-Reply-To: (message from Alan Mackenzie on Fri, 25 Jul 2025 10:32:15 +0000) Subject: Re: bug#79047: Add some multi-character pairs to some major modes. References: <87ms91gcmb.fsf@gmail.com> <867c04fzpv.fsf@gnu.org> <87ecu7vneh.fsf@gmail.com> <86ecu563ng.fsf@gnu.org> <8634ak69tc.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 79047 Cc: 79047@debbugs.gnu.org, acm@muc.de, eg642616@gmail.com, jm@pub.pink, monnier@iro.umontreal.ca X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Fri, 25 Jul 2025 10:32:15 +0000 > Cc: monnier@iro.umontreal.ca, eg642616@gmail.com, 79047@debbugs.gnu.org, > jm@pub.pink, acm@muc.de > From: Alan Mackenzie > > > And as I already mention, you perceive a convention where there is > > none. > > OK, then, Emacs hackers have abided by this non-convention nevertheless, > out of instinctive good sense and good taste. Up until > post-self-insert-hook. Which might mean there was no non-convention to begin with. > > Thus electric-pair-mode doesn't violate any conventions. > > self-insert-command, called from Lisp, is broken. There is no usable > definition of its functionality. What's wrong with its doc string as that definition? From debbugs-submit-bounces@debbugs.gnu.org Fri Jul 25 07:42:49 2025 Received: (at 79047) by debbugs.gnu.org; 25 Jul 2025 11:42:49 +0000 Received: from localhost ([127.0.0.1]:33433 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ufGp6-0006Dh-SW for submit@debbugs.gnu.org; Fri, 25 Jul 2025 07:42:49 -0400 Received: from mail.muc.de ([193.149.48.3]:38875) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ufGp3-0006DD-H0 for 79047@debbugs.gnu.org; Fri, 25 Jul 2025 07:42:47 -0400 Received: (qmail 46643 invoked by uid 3782); 25 Jul 2025 13:42:38 +0200 Received: from muc.de (pd953aea1.dip0.t-ipconnect.de [217.83.174.161]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Fri, 25 Jul 2025 13:42:37 +0200 Received: (qmail 8689 invoked by uid 1000); 25 Jul 2025 11:42:37 -0000 Date: Fri, 25 Jul 2025 11:42:37 +0000 To: Eli Zaretskii Subject: Re: bug#79047: Add some multi-character pairs to some major modes. Message-ID: References: <87ecu7vneh.fsf@gmail.com> <86ecu563ng.fsf@gnu.org> <8634ak69tc.fsf@gnu.org> <86v7ng4jes.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <86v7ng4jes.fsf@gnu.org> X-Submission-Agent: TMDA/1.3.x (Ph3nix) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 79047 Cc: 79047@debbugs.gnu.org, acm@muc.de, eg642616@gmail.com, jm@pub.pink, monnier@iro.umontreal.ca X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello, Eli. On Fri, Jul 25, 2025 at 14:08:43 +0300, Eli Zaretskii wrote: > > Date: Fri, 25 Jul 2025 10:32:15 +0000 > > Cc: monnier@iro.umontreal.ca, eg642616@gmail.com, 79047@debbugs.gnu.org, > > jm@pub.pink, acm@muc.de > > From: Alan Mackenzie > > > And as I already mention, you perceive a convention where there is > > > none. > > OK, then, Emacs hackers have abided by this non-convention nevertheless, > > out of instinctive good sense and good taste. Up until > > post-self-insert-hook. > Which might mean there was no non-convention to begin with. > > > Thus electric-pair-mode doesn't violate any conventions. > > self-insert-command, called from Lisp, is broken. There is no usable > > definition of its functionality. > What's wrong with its doc string as that definition? It's inaccurate and misleading. We have: Insert the character you type. Whichever character C you type to run this command is inserted. [Plus all the bits about the numeric prefix, abbreviations, etc.] More accurate would be: Maybe insert the character you type (depending on post-self-insert-hook). Insert or delete further characters as specified by post-self-insert-hook. Leave point at the position determined by post-self-insert-hook or after the inserted character. .. This makes it unusable in a Lisp program. For example, in c-electric-paren, which handles the user entering "(" or ")", the code needs to determine whether the "(" was entered at the end of a line. The current self-insert-command, which inserts arbitrary further characters, makes this difficult. With the current self-insert-command, there is no satisfactory way of coding c-electric-paren - only workarounds with varying degrees of ugliness. I am suggesting that self-insert-command should be made usable from Lisp again, as it once was, and have suggested a means for achieving this. -- Alan Mackenzie (Nuremberg, Germany). From debbugs-submit-bounces@debbugs.gnu.org Fri Jul 25 08:02:32 2025 Received: (at 79047) by debbugs.gnu.org; 25 Jul 2025 12:02:32 +0000 Received: from localhost ([127.0.0.1]:33517 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ufH8B-0007X9-Hc for submit@debbugs.gnu.org; Fri, 25 Jul 2025 08:02:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42662) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ufH86-0007WI-4Y for 79047@debbugs.gnu.org; Fri, 25 Jul 2025 08:02:29 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ufH7w-0004ex-JC; Fri, 25 Jul 2025 08:02:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=afNZS/2AwNMWBuf2APLHnxSK0pX9+qAHwg39DzqCYhE=; b=GVSDHBycRhmUBIXqzPZI +gDHcCNKxEB8J9v2YKW9oP3tOyW/kVIpLj5R9io6DmBoJmtZ3NbNkVNEdhC9gTsQiT9lp7MASNxJd P9fK5WfF1zC63waAVvLAhoKZFzw94v6xR/8kXgK1O6OlCN9qVnK2IgOO9EPKYeasEz9yPw3VZKhz3 Q1DsYzZwaX3RK39r3DugA95UpBS34m2YtM/2D3Z2FulZa5rSu9qIQbNLoonLV2yqCbkx3i8XOUuTt 2c4H7cIWbnje3wWLoDQrFE3pL230fwY3AF/kRRQLthSrYY05uZ+XxlxzcwrGMOPUEu/g/omWwwVEV dna3443xC2AH+w==; Date: Fri, 25 Jul 2025 15:02:12 +0300 Message-Id: <86o6t84gxn.fsf@gnu.org> From: Eli Zaretskii To: Alan Mackenzie In-Reply-To: (message from Alan Mackenzie on Fri, 25 Jul 2025 11:42:37 +0000) Subject: Re: bug#79047: Add some multi-character pairs to some major modes. References: <87ecu7vneh.fsf@gmail.com> <86ecu563ng.fsf@gnu.org> <8634ak69tc.fsf@gnu.org> <86v7ng4jes.fsf@gnu.org> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 79047 Cc: 79047@debbugs.gnu.org, acm@muc.de, eg642616@gmail.com, jm@pub.pink, monnier@iro.umontreal.ca X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Fri, 25 Jul 2025 11:42:37 +0000 > Cc: monnier@iro.umontreal.ca, eg642616@gmail.com, 79047@debbugs.gnu.org, > jm@pub.pink, acm@muc.de > From: Alan Mackenzie > > > > self-insert-command, called from Lisp, is broken. There is no usable > > > definition of its functionality. > > > What's wrong with its doc string as that definition? > > It's inaccurate and misleading. > > We have: > > Insert the character you type. > Whichever character C you type to run this command is inserted. > [Plus all the bits about the numeric prefix, abbreviations, etc.] > > More accurate would be: > > Maybe insert the character you type (depending on > post-self-insert-hook). > Insert or delete further characters as specified by > post-self-insert-hook. > Leave point at the position determined by post-self-insert-hook or > after the inserted character. Of course, if you truncate the doc string at some arbitrary point, you can claim anything about its low quality. The full doc string is this: Insert the character you type. Whichever character C you type to run this command is inserted. The numeric prefix argument N says how many times to repeat the insertion. Before insertion, ‘expand-abbrev’ is executed if the inserted character does not have word syntax and the previous character in the buffer does. After insertion, ‘internal-auto-fill’ is called if ‘auto-fill-function’ is non-nil and if the ‘auto-fill-chars’ table has a non-nil value for the inserted character. At the end, it runs ‘post-self-insert-hook’. Which does mention post-self-insert-hook. (And the ELisp manual expands on the possible uses of that hook.) What kind of argument is it when you elide arbitrary parts of the documentation, just to make your point? In what book does that qualify as a serious discussion? > .. This makes it unusable in a Lisp program. That's debatable, and is not the issue when the doc string and the definition of functionality are being discussed. > For example, in > c-electric-paren, which handles the user entering "(" or ")", the code > needs to determine whether the "(" was entered at the end of a line. > The current self-insert-command, which inserts arbitrary further > characters, makes this difficult. So we have two electric behaviors that could conflict. That's not anything new, and we have ways of handling these situations, as Stefan pointed out, and as you can see in the source code. What does this have to do with the issue at hand? > I am suggesting that self-insert-command should be made usable from Lisp > again, as it once was, and have suggested a means for achieving this. Your request is noted. I find it hard to believe that we will take that direction, since post-self-insert-hook is used in so many useful features nowadays. From debbugs-submit-bounces@debbugs.gnu.org Fri Jul 25 09:28:27 2025 Received: (at 79047) by debbugs.gnu.org; 25 Jul 2025 13:28:27 +0000 Received: from localhost ([127.0.0.1]:33814 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ufITL-000500-3L for submit@debbugs.gnu.org; Fri, 25 Jul 2025 09:28:27 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:5099) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ufITI-0004zS-AX for 79047@debbugs.gnu.org; Fri, 25 Jul 2025 09:28:25 -0400 Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 16353441104; Fri, 25 Jul 2025 09:28:18 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1753450096; bh=WHlIBDorGI4CFfqL8sAePBPyXvmSVNYZ9P5eL72a/AI=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=ofgT9iGQaxtpaKS7U26D3w5V6X3Swk0bJ7rzwpa/E6OkZNkhFosL//rZElhRhUNcg DsRFm5kdQ0gPYiZNEoUfROuKH92/0qJbDDT3/K+WNGrV0/kE2ZD7zZl5f9Kt8qYGCK QB22KgcpkZ5opg/NbFNmzKe1cXW9vkLXsGF68mV2c3PEdXnw7HIU6Lyzw9iLJCBtxG eXsMjGm1qVZeRqj8CmSQ3DRBcFIU8fsciVc8evEXpy5mZsVD5ewFO+OB1YZ0frtguz 0TQz2f+8ItRag2skrzoo/QsnnC7zhWCpphC/FWwFcj8b/T8oGNfwPkL7RxA41Ksams t4BufdBe3RYRg== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id E7496440AA7; Fri, 25 Jul 2025 09:28:16 -0400 (EDT) Received: from pastel (unknown [104.247.225.139]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id ABCB612021A; Fri, 25 Jul 2025 09:28:16 -0400 (EDT) From: Stefan Monnier To: Alan Mackenzie Subject: Re: bug#79047: Add some multi-character pairs to some major modes. In-Reply-To: Message-ID: References: <87ms91gcmb.fsf@gmail.com> <867c04fzpv.fsf@gnu.org> <87ecu7vneh.fsf@gmail.com> <86ecu563ng.fsf@gnu.org> <8634ak69tc.fsf@gnu.org> Date: Fri, 25 Jul 2025 09:28:15 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.272 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 79047 Cc: 79047@debbugs.gnu.org, Eli Zaretskii , jm@pub.pink, eg642616@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) >> Thus electric-pair-mode doesn't violate any conventions. > self-insert-command, called from Lisp, is broken. There is no usable > definition of its functionality. So far, there is no competing analysis > to mine as to how it's broken. Stefan's "solution" is not to use > self-insert-command. Your code doesn't want to use `self-insert-command`, instead it wants to do mimic `self-insert-command` but with some changes. That's exactly what `post-self-insert-hook` is for. > So it's looking like the ugly workarounds in c-electric-paren to use > self-insert-command will have to remain. I'm disappointed about this. Not for lack of an alternative, tho. Stefan From debbugs-submit-bounces@debbugs.gnu.org Fri Jul 25 09:39:30 2025 Received: (at 79047) by debbugs.gnu.org; 25 Jul 2025 13:39:31 +0000 Received: from localhost ([127.0.0.1]:33855 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ufIe1-0005iz-CC for submit@debbugs.gnu.org; Fri, 25 Jul 2025 09:39:30 -0400 Received: from mail.muc.de ([193.149.48.3]:13675) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ufIdn-0005i2-AZ for 79047@debbugs.gnu.org; Fri, 25 Jul 2025 09:39:24 -0400 Received: (qmail 87853 invoked by uid 3782); 25 Jul 2025 15:39:08 +0200 Received: from muc.de (pd953aea1.dip0.t-ipconnect.de [217.83.174.161]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Fri, 25 Jul 2025 15:39:07 +0200 Received: (qmail 10420 invoked by uid 1000); 25 Jul 2025 13:39:07 -0000 Date: Fri, 25 Jul 2025 13:39:07 +0000 To: Eli Zaretskii Subject: Re: bug#79047: Add some multi-character pairs to some major modes. Message-ID: References: <86ecu563ng.fsf@gnu.org> <8634ak69tc.fsf@gnu.org> <86v7ng4jes.fsf@gnu.org> <86o6t84gxn.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <86o6t84gxn.fsf@gnu.org> X-Submission-Agent: TMDA/1.3.x (Ph3nix) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 79047 Cc: 79047@debbugs.gnu.org, acm@muc.de, eg642616@gmail.com, jm@pub.pink, monnier@iro.umontreal.ca X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello, Eli. On Fri, Jul 25, 2025 at 15:02:12 +0300, Eli Zaretskii wrote: > > Date: Fri, 25 Jul 2025 11:42:37 +0000 > > Cc: monnier@iro.umontreal.ca, eg642616@gmail.com, 79047@debbugs.gnu.org, > > jm@pub.pink, acm@muc.de > > From: Alan Mackenzie > > > > self-insert-command, called from Lisp, is broken. There is no usable > > > > definition of its functionality. > > > What's wrong with its doc string as that definition? > > It's inaccurate and misleading. > > We have: > > Insert the character you type. > > Whichever character C you type to run this command is inserted. > > [Plus all the bits about the numeric prefix, abbreviations, etc.] > > More accurate would be: > > Maybe insert the character you type (depending on > > post-self-insert-hook). > > Insert or delete further characters as specified by > > post-self-insert-hook. > > Leave point at the position determined by post-self-insert-hook or > > after the inserted character. > Of course, if you truncate the doc string at some arbitrary point, you > can claim anything about its low quality. I abstracted the relevant bit. I'm complaining not about the doc string, which can't be made adequate, rather about the function, whose functionality has become indeterminate due to the violation of the non-convention which you deny doesn't exist. > The full doc string is this: > Insert the character you type. > Whichever character C you type to run this command is inserted. > The numeric prefix argument N says how many times to repeat the insertion. > Before insertion, ‘expand-abbrev’ is executed if the inserted character does > not have word syntax and the previous character in the buffer does. > After insertion, ‘internal-auto-fill’ is called if > ‘auto-fill-function’ is non-nil and if the ‘auto-fill-chars’ table has > a non-nil value for the inserted character. At the end, it runs > ‘post-self-insert-hook’. > Which does mention post-self-insert-hook. (And the ELisp manual > expands on the possible uses of that hook.) Yes. But that doesn't make the function usable. Before this mechanism came into existence, one could depend on self-insert-command inserting exactly one character and point being after the point of insertion. Now an arbitrary collection of characters is inserted and deleted, and point ends up in an arbitrary position. This makes self-insert-command virtually unusable from Lisp. > What kind of argument is it when you elide arbitrary parts of the > documentation, just to make your point? In what book does that > qualify as a serious discussion? As I said in my last paragraph, the bit I left out didn't really seem relevant. self-insert-command is just as unusable if one considers that part of the doc string too. > > .. This makes it unusable in a Lisp program. > That's debatable, .... Then debate it with me, please. > .... and is not the issue when the doc string and the definition of > functionality are being discussed. On the contrary, being able to use a function is the entire point of documenting it. > > For example, in c-electric-paren, which handles the user entering "(" > > or ")", the code needs to determine whether the "(" was entered at > > the end of a line. The current self-insert-command, which inserts > > arbitrary further characters, makes this difficult. > So we have two electric behaviors that could conflict. That's a most superficial way of regarding the problem, and if one looks no further, one will end up with a superficial workaround which fails to solve the underlying problem. > That's not anything new, and we have ways of handling these situations, > as Stefan pointed out, and as you can see in the source code. What Stefan suggested was no longer using self-insert-command. That is hardly practical in CC Mode. > What does this have to do with the issue at hand? I'm not sure what you see as the issue. I see the issue as the unusability of self-insert-command, and I've analysed the cause of this. Forgive me for pointing out that this was another instance of a big feature being introduced into Emacs without prior discussion on emacs-devel, what I was complaining about last November. I spotted its flaw instantly on becoming aware of the new feature, but that was too late actually to get anything done about it. > > I am suggesting that self-insert-command should be made usable from Lisp > > again, as it once was, and have suggested a means for achieving this. > Your request is noted. I find it hard to believe that we will take > that direction, since post-self-insert-hook is used in so many useful > features nowadays. I can't say I'm all that surprised, sadly. Note that my changes wouldn't remove any functionality. They would merely make self-insert-command work again predictably. I've tried putting electric-pair-post-self-insert-function and its friend onto post-command-hook instead of post-self-insert-hook. It works, sort of, but would naturaly need some debugging and testing. Or we just leave the ugly workarounds in c-electric-paren and friends and fix them whenever they break. Or replace them with other ugly workarounds of some nature, perhaps. I'm not happy about the state of c-electric-paren. -- Alan Mackenzie (Nuremberg, Germany). From debbugs-submit-bounces@debbugs.gnu.org Fri Jul 25 10:22:34 2025 Received: (at 79047) by debbugs.gnu.org; 25 Jul 2025 14:22:34 +0000 Received: from localhost ([127.0.0.1]:35003 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ufJJi-0003Uz-2H for submit@debbugs.gnu.org; Fri, 25 Jul 2025 10:22:34 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:21367) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ufJJG-0003Sh-Mr for 79047@debbugs.gnu.org; Fri, 25 Jul 2025 10:22:07 -0400 Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id A24A380A0F; Fri, 25 Jul 2025 10:22:00 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1753453319; bh=jMl1jUYmsmLh9/etJAhqSMH53WffAZvFk1wcr2U50+k=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=l+cvlhRip308XBQVpqhPeK3CHsSeFjJL0HzFITAOaoJjZlTTCXF4DgRit/WaXaKBn AdL1Z2zRyZeTGnAleTJq0PVypHA8vAD2cT2cuBifdYNAtb8Q/ESpFh3lsHuJnfKo0e /v14EKzkeQviAGaqaPRneVtqTI0TyaxariJWFXSY0YpF1fx8MRsE+3V3yN3vcQY4Js e8Zw4XHuYdzqwPzCUFyksFH7feUxcN9P90rwdxz8zHyfcfiYWL0e8pdGuQ2ocKBB1e pISvoxfhX9k5DMlewsbBAdKV/R018vidVAhcjR8nP8fHRelKHpUO6UYbU2UVF54XUR wKQVUIehrGWmg== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id A591080822; Fri, 25 Jul 2025 10:21:59 -0400 (EDT) Received: from pastel (unknown [104.247.225.139]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 6DE4A1200BA; Fri, 25 Jul 2025 10:21:59 -0400 (EDT) From: Stefan Monnier To: Alan Mackenzie Subject: Re: bug#79047: Add some multi-character pairs to some major modes. In-Reply-To: Message-ID: References: <86ecu563ng.fsf@gnu.org> <8634ak69tc.fsf@gnu.org> <86v7ng4jes.fsf@gnu.org> <86o6t84gxn.fsf@gnu.org> Date: Fri, 25 Jul 2025 10:21:58 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.267 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 79047 Cc: 79047@debbugs.gnu.org, Eli Zaretskii , jm@pub.pink, eg642616@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) >> That's not anything new, and we have ways of handling these situations, >> as Stefan pointed out, and as you can see in the source code. > What Stefan suggested was no longer using self-insert-command. I look at it as using `self-insert-command` *more*. > That is hardly practical in CC Mode. I don't see why not. My best guess is that you find it inconvenient to make the code work for Emacsen both with and without `post-self-insert-hook`, but that seems easy enough to fix with a (boundp 'post-self-insert-hook) or a version test. [ Or even simpler by dropping support for Emacs<24, which recently turned 15, BTW. =F0=9F=99=82 ] > I'm not happy about the state of c-electric-paren. It should die and be replaced by the existing `electric-*-mode`s. Stefan From debbugs-submit-bounces@debbugs.gnu.org Fri Jul 25 10:42:06 2025 Received: (at 79047) by debbugs.gnu.org; 25 Jul 2025 14:42:06 +0000 Received: from localhost ([127.0.0.1]:35135 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ufJcb-0004qs-Pc for submit@debbugs.gnu.org; Fri, 25 Jul 2025 10:42:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38108) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ufJcZ-0004pq-OO for 79047@debbugs.gnu.org; Fri, 25 Jul 2025 10:42:04 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ufJcS-0003Q2-S1; Fri, 25 Jul 2025 10:41:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=ChzM53Top/MqEhCFc6HmGHUiGdM28ul5EzwOPjbAHqg=; b=GKEn5jXGjvPS yfkunbEvHA4+aos1jxgRUWyGbBA8pfZMzXgkeIYbnZj49FB0FY4Wpe8KQ1k6O46Qh/yYYlpmyDfLK F9GwTnvPYxq1tlQSwijzZKP9pFymjYKAWkRGxEsMRMnfvaJKwFUYTZw5zGX5mpes5ugIgKnOfAFVa O8kDVt2GSdmeX25yoOlPDQ1p486yr5gAjC8XPcl/5mot3mLCJK+i2G7fiAXAyQFAeP6xXgmEAgojv xYEKAf44qwtJEOzB9pQlmljveJGAhjE2j2BfSUVYgJfnA5KW+t/NARouZBC36XoU6HyYduEpc4mOE /Mi5aw5Pl1J1eKMJrZvJ0w==; Date: Fri, 25 Jul 2025 17:41:54 +0300 Message-Id: <864iv049jh.fsf@gnu.org> From: Eli Zaretskii To: Alan Mackenzie In-Reply-To: (message from Alan Mackenzie on Fri, 25 Jul 2025 13:39:07 +0000) Subject: Re: bug#79047: Add some multi-character pairs to some major modes. References: <86ecu563ng.fsf@gnu.org> <8634ak69tc.fsf@gnu.org> <86v7ng4jes.fsf@gnu.org> <86o6t84gxn.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 79047 Cc: 79047@debbugs.gnu.org, acm@muc.de, eg642616@gmail.com, jm@pub.pink, monnier@iro.umontreal.ca X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Fri, 25 Jul 2025 13:39:07 +0000 > Cc: monnier@iro.umontreal.ca, eg642616@gmail.com, 79047@debbugs.gnu.org, > jm@pub.pink, acm@muc.de > From: Alan Mackenzie > > > What does this have to do with the issue at hand? > > I'm not sure what you see as the issue. This is a bug report whose purpose is stated in the Subject and in the original message posted to the discussion. Could we please return to that issue, and leave your gripes about post-self-insert-hook to another discussion? > I see the issue as the > unusability of self-insert-command, and I've analysed the cause of this. That's not the issue at hand. The issue at hand is the question asked in https://debbugs.gnu.org/cgi/bugreport.cgi?bug=79047#5 I'd like to hear your opinion about that suggestion wrt CC Mode. If you are against that, please just say so, and then we will not make the suggested changes in CC Mode. If you don't mind, or want to see the proposed patch, or have some other response to that question, specifically, please voice your opinions, and let's move on. > Forgive me for pointing out that this was another instance of a big > feature being introduced into Emacs without prior discussion > on emacs-devel, what I was complaining about last November. I spotted > its flaw instantly on becoming aware of the new feature, but that was too > late actually to get anything done about it. Sorry, that's not relevant to this bug report. > I'm not happy about the state of c-electric-paren. I understand, but that is not what is being discussed here. From debbugs-submit-bounces@debbugs.gnu.org Fri Jul 25 12:11:16 2025 Received: (at 79047) by debbugs.gnu.org; 25 Jul 2025 16:11:16 +0000 Received: from localhost ([127.0.0.1]:35542 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ufL0t-0002kW-QP for submit@debbugs.gnu.org; Fri, 25 Jul 2025 12:11:16 -0400 Received: from mail.muc.de ([193.149.48.3]:56311) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ufL0p-0002ju-Dl for 79047@debbugs.gnu.org; Fri, 25 Jul 2025 12:11:13 -0400 Received: (qmail 72309 invoked by uid 3782); 25 Jul 2025 18:11:04 +0200 Received: from muc.de (pd953aea1.dip0.t-ipconnect.de [217.83.174.161]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Fri, 25 Jul 2025 18:11:04 +0200 Received: (qmail 12965 invoked by uid 1000); 25 Jul 2025 16:11:03 -0000 Date: Fri, 25 Jul 2025 16:11:03 +0000 To: Eli Zaretskii Subject: Re: bug#79047: Add some multi-character pairs to some major modes. Message-ID: References: <8634ak69tc.fsf@gnu.org> <86v7ng4jes.fsf@gnu.org> <86o6t84gxn.fsf@gnu.org> <864iv049jh.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <864iv049jh.fsf@gnu.org> X-Submission-Agent: TMDA/1.3.x (Ph3nix) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 79047 Cc: 79047@debbugs.gnu.org, acm@muc.de, eg642616@gmail.com, jm@pub.pink, monnier@iro.umontreal.ca X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello, Eli. On Fri, Jul 25, 2025 at 17:41:54 +0300, Eli Zaretskii wrote: > > Date: Fri, 25 Jul 2025 13:39:07 +0000 > > Cc: monnier@iro.umontreal.ca, eg642616@gmail.com, 79047@debbugs.gnu.org, > > jm@pub.pink, acm@muc.de > > From: Alan Mackenzie [ .... ] > The issue at hand is the question asked in > https://debbugs.gnu.org/cgi/bugreport.cgi?bug=79047#5 OK. I've already voiced some doubts about this proposed change. Does Emacs really need Yet One More Way of entering a comment? It will need at least one more user option distinct from electric-pair-mode, for example. Elijah has responded to this point, stating he believes it would be useful. I said (yesterday) that I thought the commit commit 60fbeda771639ded68ffd0666df340c7a06cafcf Author: Elías Gabriel Pérez Date: Thu Apr 24 17:34:58 2025 -0600 Support strings for electric pairs (bug#78053) was unfinished and should be finished before implementing the proposed change. > I'd like to hear your opinion about that suggestion wrt CC Mode. If > you are against that, please just say so, and then we will not make > the suggested changes in CC Mode. If you don't mind, or want to see > the proposed patch, or have some other response to that question, > specifically, please voice your opinions, and let's move on. I'm not really against the bug's proposal being in CC Mode. Just it will cause an extension of all the nastiness in CC Mode we were discussing earlier on today. I can live with that. So if the feature as a whole gets implemented, I would certainly introduce it into CC Mode, too. [ .... ] -- Alan Mackenzie (Nuremberg, Germany). From debbugs-submit-bounces@debbugs.gnu.org Fri Jul 25 14:05:17 2025 Received: (at 79047) by debbugs.gnu.org; 25 Jul 2025 18:05:17 +0000 Received: from localhost ([127.0.0.1]:36052 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ufMnE-0002Cs-KN for submit@debbugs.gnu.org; Fri, 25 Jul 2025 14:05:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53970) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ufMnC-0002A5-Qb for 79047@debbugs.gnu.org; Fri, 25 Jul 2025 14:05:15 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ufMmw-0003W5-K1; Fri, 25 Jul 2025 14:05:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=GzQgX650jbeH7TwTrf8OJy5m4JzR292l4ceIGbjcGo8=; b=GKlzZs6JQmhB CBp17QJh++ABaiDQRemMNdSvJOPWoVufKhSDhIbrK8XRwrlBqoLtjlrLlAOLdmPy6XAOOQZadPm0t Z6CuIMwIoRmox0uy8qzFCLeP1T9TVHQAy9a9KT8GWBlSWlgT/ItDhF64GKFQu4N4gW9TvJ/9ZzvHG VO/siocxNRVwikYa4oJfBfQWLOlpPhqWNcQZaPOAxEJ/LvhvRMERLdZTKoFepatbhhmvgIfOczwji 9P7Cj3ouklQDNtLY5uGExxxDnSMdy3Z8kAjY6B5Ksty7ZhzzBOPTcSWMIjrctz3NfBSK6kgjbYhzd moyM0V9vYvsB8RPz26ZKMQ==; Date: Fri, 25 Jul 2025 21:04:53 +0300 Message-Id: <86v7ng2lkq.fsf@gnu.org> From: Eli Zaretskii To: Alan Mackenzie In-Reply-To: (message from Alan Mackenzie on Fri, 25 Jul 2025 16:11:03 +0000) Subject: Re: bug#79047: Add some multi-character pairs to some major modes. References: <8634ak69tc.fsf@gnu.org> <86v7ng4jes.fsf@gnu.org> <86o6t84gxn.fsf@gnu.org> <864iv049jh.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 79047 Cc: 79047@debbugs.gnu.org, acm@muc.de, eg642616@gmail.com, jm@pub.pink, monnier@iro.umontreal.ca X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Fri, 25 Jul 2025 16:11:03 +0000 > Cc: monnier@iro.umontreal.ca, eg642616@gmail.com, 79047@debbugs.gnu.org, > jm@pub.pink, acm@muc.de > From: Alan Mackenzie > > On Fri, Jul 25, 2025 at 17:41:54 +0300, Eli Zaretskii wrote: > > > Date: Fri, 25 Jul 2025 13:39:07 +0000 > > > Cc: monnier@iro.umontreal.ca, eg642616@gmail.com, 79047@debbugs.gnu.org, > > > jm@pub.pink, acm@muc.de > > > From: Alan Mackenzie > > [ .... ] > > > The issue at hand is the question asked in > > https://debbugs.gnu.org/cgi/bugreport.cgi?bug=79047#5 > > OK. I've already voiced some doubts about this proposed change. We are asking for your opinion, not for doubts. If you object for such a change in CC Mode, then we will not make such changes there. > Does Emacs really need Yet One More Way of entering a comment? I don't know. Asking you and other mode maintainers was meant to provide feedback to make the decision. > > I'd like to hear your opinion about that suggestion wrt CC Mode. If > > you are against that, please just say so, and then we will not make > > the suggested changes in CC Mode. If you don't mind, or want to see > > the proposed patch, or have some other response to that question, > > specifically, please voice your opinions, and let's move on. > > I'm not really against the bug's proposal being in CC Mode. Just it > will cause an extension of all the nastiness in CC Mode we were > discussing earlier on today. I can live with that. > > So if the feature as a whole gets implemented, I would certainly > introduce it into CC Mode, too. Thanks. From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 02 09:59:37 2025 Received: (at 79047) by debbugs.gnu.org; 2 Aug 2025 13:59:37 +0000 Received: from localhost ([127.0.0.1]:36725 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uiClt-0007r0-0w for submit@debbugs.gnu.org; Sat, 02 Aug 2025 09:59:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44072) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uiClq-0007qY-1C for 79047@debbugs.gnu.org; Sat, 02 Aug 2025 09:59:35 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uiCli-0005kY-Ls; Sat, 02 Aug 2025 09:59:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=3I8R8EYzaN8X9Hxz48pqBjiPnlZ5/2IIbQKpNwAx0dM=; b=CHrbjo0JfbvwrZNN0AGR c7fjLmjc2qY8DszeJy7ukzbeqXd2U6E2J7fli1lAHCfDTQiosola2PjmX5IMiyAUWRreXB+Ofb0Rp ANNAKAF2tFG1NpRuD/YA+zQ3UmlXVfe5kf4M9rUw2VyM1kgYCmTLSyMuM9/X0/PB2YeAAzLic/Jjg TmXX27g9H6e/1rnzHf0T49KgJyfrth/v+opHgYBroSZfZHquqEpFDBzDvMNJIICglfXYPBGyoYOXE 11IuFzRsFn2qPk03ILsI+P30vDwg29U2cWGuLpHCLtIQFH2hH7iyg0GVi7W2xdNMnKPK+oohrTWSr 9Y6AfmsMN/Kt+w==; Date: Sat, 02 Aug 2025 16:59:23 +0300 Message-Id: <86v7n5rfic.fsf@gnu.org> From: Eli Zaretskii To: Elijah Gabe =?iso-8859-1?Q?P=E9rez?= In-Reply-To: <87ecu7vneh.fsf@gmail.com> (message from Elijah Gabe =?iso-8859-1?Q?P=E9rez?= on Tue, 22 Jul 2025 17:03:34 -0600) Subject: Re: bug#79047: Add some multi-character pairs to some major modes. References: <87ms91gcmb.fsf@gmail.com> <867c04fzpv.fsf@gnu.org> <87ecu7vneh.fsf@gmail.com> MIME-version: 1.0 Content-type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 79047 Cc: 79047@debbugs.gnu.org, acm@muc.de, jm@pub.pink, monnier@iro.umontreal.ca X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Elijah Gabe Pérez > Cc: 79047@debbugs.gnu.org, Eli Zaretskii , John Muhl > , Stefan Monnier > Date: Tue, 22 Jul 2025 17:03:34 -0600 > > Alan Mackenzie writes: > > > Hello, Elijah. > > > > One important point. > > > > Are you sure about this? In NEWS, there is the rather sloppily worded > > entry: > > > > ** 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. > > > > It uses the sloppy American English ambiguity where "multiple" can mean > > either "several", or "composed of several parts". In correct British > > English "multiple" has only the latter meaning. > > > > I think in this NEWS entry the meaning "several" was intended, and you > > may have misread it. I don't think electric-pair-mode has any facilities > > for pairing a multiple delimiter; only for pairing several of the same > > delimiter at once, e.g. (((....))). > > That is the wrong NEWS entry of the feature. > The real one is this: > > *** Electric Pair mode now supports multi-character paired delimiters. > 'electric-pair-pairs' and 'electric-pair-text-pairs' now allow using > strings for multi-character paired delimiters. > > To use this, add a list to both electric pair user options: '("/*" . "*/")'. > > You can also specify to insert an extra space after the first string > pair: '("/*" " */" t)'. > > > Please check if I am correct or mistaken on this point. If I'm correct, > > then the prerequisites for implementing this change are absent, and there > > is nothing more to discuss. > > I've tested the feature, it's possible to achieve it: > > (setq electric-pair-pairs `((,(regexp-quote "/*") " */" t))) > > /* | */ > ^^ After inserting the * character. > (the extra whitespace is optionally included) Can we please have a patch to install, which incorporates all the discussions we had here? From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 04 16:04:14 2025 Received: (at 79047) by debbugs.gnu.org; 4 Aug 2025 20:04:14 +0000 Received: from localhost ([127.0.0.1]:52741 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uj1Pq-0000Rc-4G for submit@debbugs.gnu.org; Mon, 04 Aug 2025 16:04:14 -0400 Received: from mail-oa1-x42.google.com ([2001:4860:4864:20::42]:48350) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1uj1Pn-0000RF-G5 for 79047@debbugs.gnu.org; Mon, 04 Aug 2025 16:04:12 -0400 Received: by mail-oa1-x42.google.com with SMTP id 586e51a60fabf-2eb5cbe41e1so3811038fac.0 for <79047@debbugs.gnu.org>; Mon, 04 Aug 2025 13:04:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1754337845; x=1754942645; darn=debbugs.gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=FG8BQsHiTBr+Ar+Ivhh8era1KqHYiNWkb+pR2Tyjd3A=; b=m7cKDLuC8HP5m3D8nU6Sm1wQqWZm4kak+dRl1rf1sbafVF0T8Vw7SlUFunYHlgRo7V xT4NOzboGGEskkzuxYhgOqJtycrtkUpg4MZtxggDHLHad5a2evsul1sN4Kt8Rv//bpZh DyDxeU9SLawdP2jxduLtmNGmtMUXYQG2ya0LJ9ccewzu0Rv49/YlVdBH6GcU6nBNrenw 0y2Epyzu34qGMnvANiRBBOK1EqOOvhVGI4mIcrPvwBafiQnOQdH2dWn64rptXL9Fh1FD LL1bCbSMTxrKH9Vgdr78Yfh5E0uOMoF1tZg2ZxNFIa3lqUShWDP3hZn/RTToywrcdJu1 lhBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754337845; x=1754942645; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=FG8BQsHiTBr+Ar+Ivhh8era1KqHYiNWkb+pR2Tyjd3A=; b=FDazUDwaxwGHBfvc3UQncOx7Jxu4iQ0nHT0EZBAydgbKj6lrmqIV6PJoSvl6wi58dS 4C1dnXDo0WPDcQFhDnc9Uh/bevzd0diakD0SXCjd0WcdweI3ScfO06U4o3k71JQ90EE7 8J/f4OEqJ8L8kR7w/J+caCY+1kwZVZjCghlIINKc5139/gfKoWnU7Qzr52E33wDriXK/ rtcZ36es0gUIwQJvQq03IH7P9FGcW2apjKr9KKnsbmW5M8qab7Jxi1JaeoCmyyIlzaRy vckes7J7nm8bxFzHGQTfHEY88kdgogro+YRVYbT8AZuZ1Ee+raScMZSN5ujAigV/K5dV 1m6Q== X-Gm-Message-State: AOJu0YyVpdx7OSTOJSi5J2EYwtbpwOzrsUyozCvX3G9RGFeN6+EtqV12 7rQ/CcWHV8j8KnM2WdKTMNfsrY67pF7Il+H6Pz6BA3wwQiAMaOHQsOHn X-Gm-Gg: ASbGncv6sa50Aj+Q6SAIimCZ+xnG4nB8uaenE5EBoJMwyR07omqh+KxwLJixX11MPET BTNUtEw/6Q6IgO4oxLtWRvTk6JGXY+UFZdU1qo4iurjBn0R5xCW+FbgvYxDFLIS7E5xXAxZKMw4 jipeqt/ySAMDy/LMkDUk6K/RAR6xRGY1wp/SZLDJhxGy+s6WiGtZhiLRjNEjHddBMzGmRtc28KU wl1SpUSNKxC7rWK5gENtaZuOal4D9mXv3/3yIOeU+JWMtjqnCEQ+3t/W4Y5sWksUMs2OBjvZYP8 dvJWx1xbAS1q8tMzgaoYVOdbd4zXjnSb1SBbLoU0bgP2QkNKK5YFketdhTcVAB70YzJd+6Dwm8A 4rOyYagApZdMRXmM= X-Google-Smtp-Source: AGHT+IFKKQ8IYYqZzx8lWblgXv15HxnvlI64KUB5MGpuFgygxQCkv7S1cSMNslL5mCzIrRi1cZZDeQ== X-Received: by 2002:a05:6870:239c:b0:306:9f8e:6699 with SMTP id 586e51a60fabf-30b67a15235mr6763686fac.30.1754337845288; Mon, 04 Aug 2025 13:04:05 -0700 (PDT) Received: from fedora ([189.215.161.127]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-307ae88a585sm2712117fac.1.2025.08.04.13.04.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Aug 2025 13:04:04 -0700 (PDT) From: =?utf-8?Q?Elijah_Gabe_P=C3=A9rez?= To: Eli Zaretskii Subject: Re: bug#79047: Add some multi-character pairs to some major modes. In-Reply-To: <86v7n5rfic.fsf@gnu.org> References: <87ms91gcmb.fsf@gmail.com> <867c04fzpv.fsf@gnu.org> <87ecu7vneh.fsf@gmail.com> <86v7n5rfic.fsf@gnu.org> Date: Mon, 04 Aug 2025 14:03:58 -0600 Message-ID: <87v7n2yhu9.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 79047 Cc: 79047@debbugs.gnu.org, acm@muc.de, jm@pub.pink, monnier@iro.umontreal.ca X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) --=-=-= Content-Type: text/plain Eli Zaretskii writes: > Can we please have a patch to install, which incorporates all the > discussions we had here? Sorry for the delay. Here is the patch: --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Add-multi-character-pairs-to-lua-ts-mode-and-texinfo.patch Content-Description: Only for lua-ts-mode and texinfo-mode >From 94a413740bf19dc3d86a10fad3786c7632992239 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?El=C3=ADas=20Gabriel=20P=C3=A9rez?= Date: Mon, 4 Aug 2025 12:47:18 -0600 Subject: [PATCH] Add multi-character pairs to lua-ts-mode and texinfo-mode. * etc/NEWS: Add entry for lua-ts-mode changes. * lisp/progmodes/lua-ts-mode.el (lua-ts-auto-close-block-comments): New user option. (lua-ts-mode): Add '--[[ ]]' pairs to 'electric-pair-pairs' only if 'lua-ts-auto-close-block-comments' is non-nil. * lisp/textmodes/texinfo.el (texinfo-mode): Add "`` ''" pairs to 'electric-pair-pairs'. * test/lisp/progmodes/lua-ts-mode-tests.el (lua-ts-test-auto-close-block-comments): Add new test. --- etc/NEWS | 7 +++++++ lisp/progmodes/lua-ts-mode.el | 13 +++++++++++++ lisp/textmodes/texinfo.el | 9 +++++++++ test/lisp/progmodes/lua-ts-mode-tests.el | 12 ++++++++++++ 4 files changed, 41 insertions(+) diff --git a/etc/NEWS b/etc/NEWS index e12a9dcb127..253eda9edb2 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -878,6 +878,13 @@ build tags for the test commands. The 'go-ts-mode-test-flags' user option is available to set a list of additional flags to pass to the go test command line. +** Lua-ts mode + +--- +*** New user option 'lua-ts-auto-close-block-comments'. +When non-nil, inserting a block comment "--[[" will close it inserting +its respective "]]". By default, this is disabled. + ** Java-ts mode +++ diff --git a/lisp/progmodes/lua-ts-mode.el b/lisp/progmodes/lua-ts-mode.el index 5e58d4c071d..3df36e329b3 100644 --- a/lisp/progmodes/lua-ts-mode.el +++ b/lisp/progmodes/lua-ts-mode.el @@ -74,6 +74,11 @@ lua-ts-indent-offset :safe 'natnump :version "30.1") +(defcustom lua-ts-auto-close-block-comments nil + "If non-nil, inserting a block comment \"--[[\" will insert its respective \"]]\"." + :type 'boolean + :version "31.1") + (defcustom lua-ts-luacheck-program "luacheck" "Location of the Luacheck program." :type 'file @@ -675,6 +680,14 @@ lua-ts-mode (setq-local comment-start-skip "--\\s-*") (setq-local comment-end "") + ;; Pairs. + (when (and lua-ts-auto-close-block-comments + (boundp 'electric-pair-pairs)) + (setq-local electric-pair-pairs + (cons + '("--\\[\\[" . "\n]") + electric-pair-pairs))) + ;; Font-lock. (setq-local treesit-font-lock-settings lua-ts--font-lock-settings) (setq-local treesit-font-lock-feature-list diff --git a/lisp/textmodes/texinfo.el b/lisp/textmodes/texinfo.el index 58ab5f16806..e14c1669ae7 100644 --- a/lisp/textmodes/texinfo.el +++ b/lisp/textmodes/texinfo.el @@ -505,6 +505,15 @@ texinfo-mode (setq-local syntax-propertize-function texinfo-syntax-propertize-function) (setq-local add-log-current-defun-function #'texinfo-current-defun-name) + ;; Pairs settings + (when (boundp 'electric-pair-pairs) + (setq-local electric-pair-pairs + (cons + ;; `` '' pairs + '("\\(?:^\\|[[:space:]]\\)``" + . "''") + electric-pair-pairs))) + ;; Outline settings. (setq-local outline-heading-alist ;; We should merge `outline-heading-alist' and diff --git a/test/lisp/progmodes/lua-ts-mode-tests.el b/test/lisp/progmodes/lua-ts-mode-tests.el index b14e9518451..44940335776 100644 --- a/test/lisp/progmodes/lua-ts-mode-tests.el +++ b/test/lisp/progmodes/lua-ts-mode-tests.el @@ -25,6 +25,7 @@ (require 'hideshow) (require 'treesit) (require 'which-func) +(require 'elec-pair) (ert-deftest lua-ts-test-indentation () (skip-unless (treesit-ready-p 'lua t)) @@ -61,6 +62,17 @@ lua-ts-test-hideshow (should (= 0 (length (overlays-in (point-min) (point-max))))) (hs-minor-mode -1))) +(ert-deftest lua-ts-test-auto-close-block-comments () + (with-temp-buffer + (setq-local lua-ts-auto-close-block-comments t) + (electric-pair-local-mode) + (lua-ts-mode) + (insert "--") + (let ((last-command-event ?\[)) + (ert-simulate-command '(self-insert-command 1)) + (ert-simulate-command '(self-insert-command 1))) + (should (equal "--[[\n]]" (buffer-string))))) + (provide 'lua-ts-mode-tests) ;;; lua-ts-mode-tests.el ends here -- 2.50.1 --=-=-= Content-Type: text/plain -- - E.G via Gnus and Org. --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 07 09:17:48 2025 Received: (at 79047) by debbugs.gnu.org; 7 Aug 2025 13:17:48 +0000 Received: from localhost ([127.0.0.1]:34054 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uk0VA-0007Cd-BW for submit@debbugs.gnu.org; Thu, 07 Aug 2025 09:17:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59032) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uk0V7-0007CM-Ad for 79047@debbugs.gnu.org; Thu, 07 Aug 2025 09:17:46 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uk0Uz-0002Rh-28; Thu, 07 Aug 2025 09:17:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=f6S9ZK48RfP4Yd5/el9Y6COfyaMzIbs9RmL/bhLZAnM=; b=jZ6XyiJzjCcJAT3gzqoK N4T7gJU7a56mltKbRYJ33mU6ZolvK8O+cAR8dcoRnvDmXXpkq5b/mIXx5f7a2U/0/mpkvIxkERb0q Y5jbwE9VdOxiJuZxFw7NrJuQSVxEYwrxocVxbhsoBJ7WHjzDWvmgtDkPI4to0FGc10bLaz7pHh1VU kqrHaxn8MplMgaX5g8uRsuoU972hPd7jFIKPP5svSg2KNwLPtpbInx2AyhndRVlVM4X1LNTrozcGp Fgrok8+bDEuuiJHVERAb++WQAH+41c0Bv7py0RU8xOipOHQgoY4EZmiyi+vE8IXLfLxUZGxzdPfBB 7byWmdXEEctdBQ==; Date: Thu, 07 Aug 2025 16:17:32 +0300 Message-Id: <86ectnqnir.fsf@gnu.org> From: Eli Zaretskii To: Elijah Gabe =?iso-8859-1?Q?P=E9rez?= In-Reply-To: <87v7n2yhu9.fsf@gmail.com> (message from Elijah Gabe =?iso-8859-1?Q?P=E9rez?= on Mon, 04 Aug 2025 14:03:58 -0600) Subject: Re: bug#79047: Add some multi-character pairs to some major modes. References: <87ms91gcmb.fsf@gmail.com> <867c04fzpv.fsf@gnu.org> <87ecu7vneh.fsf@gmail.com> <86v7n5rfic.fsf@gnu.org> <87v7n2yhu9.fsf@gmail.com> MIME-version: 1.0 Content-type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 79047 Cc: 79047@debbugs.gnu.org, acm@muc.de, jm@pub.pink, monnier@iro.umontreal.ca X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Elijah Gabe Pérez > Cc: 79047@debbugs.gnu.org, acm@muc.de, jm@pub.pink, monnier@iro.umontreal.ca > Date: Mon, 04 Aug 2025 14:03:58 -0600 > > Eli Zaretskii writes: > > > Can we please have a patch to install, which incorporates all the > > discussions we had here? > > Sorry for the delay. > > Here is the patch: Thanks. It LGTM, but why isn't the change in Texinfo called out in NEWS, like you did with lua-ts-mode? From debbugs-submit-bounces@debbugs.gnu.org Fri Aug 08 01:37:50 2025 Received: (at 79047) by debbugs.gnu.org; 8 Aug 2025 05:37:50 +0000 Received: from localhost ([127.0.0.1]:36726 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ukFna-00035N-1w for submit@debbugs.gnu.org; Fri, 08 Aug 2025 01:37:50 -0400 Received: from mail-oo1-xc44.google.com ([2607:f8b0:4864:20::c44]:43251) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1ukFnW-000353-SK for 79047@debbugs.gnu.org; Fri, 08 Aug 2025 01:37:48 -0400 Received: by mail-oo1-xc44.google.com with SMTP id 006d021491bc7-61b78af3b11so329590eaf.0 for <79047@debbugs.gnu.org>; Thu, 07 Aug 2025 22:37:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1754631461; x=1755236261; darn=debbugs.gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=/Xu0hggf1YM8+NYph77LYYcPucek2nXnM7llZpiLEOc=; b=UE768xvbLG2yIRUHCO0yHh+RAbfKPrdDhwhRW1c/9Lg9htPyX/J9MSocpxhP/xDfen ncQLV5ahcsT8gqc372PVNXorDNP5lDszXH3/IF6BOKECjeeMDz7pNTsUh010zRH/6WFt xt9nRdMr13MLKQY2APH6K2X6fBrzh5/t1AdJzdpKmaosq8x89//l/ZZIZfcYmtuaYc/V Qg9zrrByB9AqzPoGmb2DKop3aKxXxMlZjoRi0gHS6oVY6VCnLBKBHLzj3zi7+Pc1a2eL 1AXzXd+fX3ZdvUiZbNS69KAe/QuvBLeE9QPJ3F9fdldKpTC6BJ4Us22BBH3a+/wJJf/q TcYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754631461; x=1755236261; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=/Xu0hggf1YM8+NYph77LYYcPucek2nXnM7llZpiLEOc=; b=BJxx2pUMFJoTcjZd5lwmW0Ain9MOqbl0HPzlnYWoZcQtrwvD89P7ufp6lHpS+jLA2B lrL4LOegqA7i8/7zKqAtPiOCdgt4pN+ztUvkdp5AOv8c6KA9OW2jIToPx0qlnEizTygR bWjn+zYGXg8SIm6Z61Bq0AxaXMjCwUzsq2FGWANBFBKUig0a0JSklMiIruHWFISJegsv UkBdij677wrkj40tvl71dHD8hmmt4u1m6zZVMJGbF/xeq09nFc8z8e/cYzxujPdC/9y3 dTeONo9iZTOpTFJkZZKj7vkoXTSQ/x4fOpCwlggZeYP1eaYFhmJKOIC1cQ6N5VphEOSK z1LA== X-Gm-Message-State: AOJu0Yw5jyL+tTAvKAaYHQe+jcrFhqAGdovfUSkQMMu1lk19hAvpr3IR 27SHp28hIf1oMFRiMjc0nW7rfq12ZFLdmitHTH7Qw3i4ZyF31pMXYF5x X-Gm-Gg: ASbGncuJytqGjDy+LlryvtKnsw5zTpMNt1BWbUaet/PgY+yne3vziB6n/VanXSaEwPn jd5yZWpMNXVNPLQJVqQB+/oGBHxUhPpbTzM46A+8IKvHa5qErmRdnCiUHJELq59mdKGNLzv8YA0 0UOx/zlzaYv/0A/9wUAPClLrkCp5IgiG8ZZFEf4cftAo5BwraQvNz5wIDD9xDNMCBEzFh5/Lzm3 OYau5BXstQYkZagH2TtN3TOZNYg1GOXb79/T5wxVkH1uaaz+Divgfez1mh9pA6wqv5Jv3suRlPm 8wvIow16Uyc8qu+XsSEmdOtrgeXlV/UUkHiRsHQuIVe8OgVCt7oAOjHOSjPRunDm98F4Q25J5eu sAe45D3SBRNmtRhw= X-Google-Smtp-Source: AGHT+IEEACUzdpGVnhnhAMAsd3vABJC2p6HDwo9cwpzhT/bZmnZrpNglqoLGU709sX5UiT9VQFvnBg== X-Received: by 2002:a05:6808:4f25:b0:433:e8b7:14b6 with SMTP id 5614622812f47-435998aac9cmr844290b6e.7.1754631460647; Thu, 07 Aug 2025 22:37:40 -0700 (PDT) Received: from fedora ([189.215.161.127]) by smtp.gmail.com with ESMTPSA id 5614622812f47-43576ecdafesm1400730b6e.7.2025.08.07.22.37.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Aug 2025 22:37:39 -0700 (PDT) From: =?utf-8?Q?Elijah_Gabe_P=C3=A9rez?= To: Eli Zaretskii Subject: Re: bug#79047: Add some multi-character pairs to some major modes. In-Reply-To: <86ectnqnir.fsf@gnu.org> References: <87ms91gcmb.fsf@gmail.com> <867c04fzpv.fsf@gnu.org> <87ecu7vneh.fsf@gmail.com> <86v7n5rfic.fsf@gnu.org> <87v7n2yhu9.fsf@gmail.com> <86ectnqnir.fsf@gnu.org> Date: Thu, 07 Aug 2025 23:37:35 -0600 Message-ID: <8734a2xtk0.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 79047 Cc: 79047@debbugs.gnu.org, acm@muc.de, jm@pub.pink, monnier@iro.umontreal.ca X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Eli Zaretskii writes: >> From: Elijah Gabe P=C3=A9rez >> Cc: 79047@debbugs.gnu.org, acm@muc.de, jm@pub.pink, monnier@iro.umont= real.ca >> Date: Mon, 04 Aug 2025 14:03:58 -0600 >>=20 >> Eli Zaretskii writes: >>=20 >> > Can we please have a patch to install, which incorporates all the >> > discussions we had here? >>=20 >> Sorry for the delay. >>=20 >> Here is the patch: > > Thanks. It LGTM, but why isn't the change in Texinfo called out in > NEWS, like you did with lua-ts-mode? I'm not sure it needs to be in NEWS, it's a very small change. In lua-ts-mode I announced it because it uses a new option to enable the feature. However if it needs to be in NEWS, here is a patch which includes it: --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: attachment; filename=0001-Add-multi-character-pairs-to-lua-ts-mode-and-texinfo.patch Content-Transfer-Encoding: quoted-printable >From dd672cc34d6842ccf32610d5b2c75cd197087b2b Mon Sep 17 00:00:00 2001 From: =3D?UTF-8?q?El=3DC3=3DADas=3D20Gabriel=3D20P=3DC3=3DA9rez?=3D Date: Mon, 4 Aug 2025 12:47:18 -0600 Subject: [PATCH] Add multi-character pairs to lua-ts-mode and texinfo-mode. * etc/NEWS: Add entry for lua-ts-mode changes. * lisp/progmodes/lua-ts-mode.el (lua-ts-auto-close-block-comments): New user option. (lua-ts-mode): Add '--[[ ]]' pairs to 'electric-pair-pairs' only if 'lua-ts-auto-close-block-comments' is non-nil. * lisp/textmodes/texinfo.el (texinfo-mode): Add "`` ''" pairs to 'electric-pair-pairs'. * test/lisp/progmodes/lua-ts-mode-tests.el (lua-ts-test-auto-close-block-comments): Add new test. --- etc/NEWS | 15 +++++++++++ lisp/progmodes/lua-ts-mode.el | 13 ++++++++++ lisp/textmodes/texinfo.el | 9 +++++++ test/lisp/progmodes/lua-ts-mode-tests.el | 33 ++++++++++++++++++++++++ 4 files changed, 70 insertions(+) diff --git a/etc/NEWS b/etc/NEWS index e12a9dcb127..ffbad5f0613 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -878,6 +878,13 @@ build tags for the test commands. The 'go-ts-mode-test-flags' user option is available to set a list of additional flags to pass to the go test command line. =20 +** Lua-ts mode + +--- +*** New user option 'lua-ts-auto-close-block-comments'. +When non-nil, inserting a block comment "--[[" will close it by +inserting its respective "]]". By default, this is disabled. + ** Java-ts mode =20 +++ @@ -929,6 +936,14 @@ characters in CJK texts. For example, 'A' is converte= d to '=EF=BC=A1', '1' is converted to '=EF=BC=91', etc. Companion commands 'halfwidth-region' and 'halfwidth-word' perform the opposite conversion. =20 +** Texinfo Mode + +--- +*** texinfo-mode now can auto-close the ``'' pairs. +Now inserting `` in 'texinfo-mode' will close it by inserting its +respective ''. + + ** ASM mode =20 --- diff --git a/lisp/progmodes/lua-ts-mode.el b/lisp/progmodes/lua-ts-mode.el index 5e58d4c071d..3df36e329b3 100644 --- a/lisp/progmodes/lua-ts-mode.el +++ b/lisp/progmodes/lua-ts-mode.el @@ -74,6 +74,11 @@ lua-ts-indent-offset :safe 'natnump :version "30.1") =20 +(defcustom lua-ts-auto-close-block-comments nil + "If non-nil, inserting a block comment \"--[[\" will insert its respecti= ve \"]]\"." + :type 'boolean + :version "31.1") + (defcustom lua-ts-luacheck-program "luacheck" "Location of the Luacheck program." :type 'file @@ -675,6 +680,14 @@ lua-ts-mode (setq-local comment-start-skip "--\\s-*") (setq-local comment-end "") =20 + ;; Pairs. + (when (and lua-ts-auto-close-block-comments + (boundp 'electric-pair-pairs)) + (setq-local electric-pair-pairs + (cons + '("--\\[\\[" . "\n]") + electric-pair-pairs))) + ;; Font-lock. (setq-local treesit-font-lock-settings lua-ts--font-lock-settings) (setq-local treesit-font-lock-feature-list diff --git a/lisp/textmodes/texinfo.el b/lisp/textmodes/texinfo.el index 58ab5f16806..e14c1669ae7 100644 --- a/lisp/textmodes/texinfo.el +++ b/lisp/textmodes/texinfo.el @@ -505,6 +505,15 @@ texinfo-mode (setq-local syntax-propertize-function texinfo-syntax-propertize-functio= n) (setq-local add-log-current-defun-function #'texinfo-current-defun-name) =20 + ;; Pairs settings + (when (boundp 'electric-pair-pairs) + (setq-local electric-pair-pairs + (cons + ;; `` '' pairs + '("\\(?:^\\|[[:space:]]\\)``" + . "''") + electric-pair-pairs))) + ;; Outline settings. (setq-local outline-heading-alist ;; We should merge `outline-heading-alist' and diff --git a/test/lisp/progmodes/lua-ts-mode-tests.el b/test/lisp/progmodes= /lua-ts-mode-tests.el index b14e9518451..b3267367e90 100644 --- a/test/lisp/progmodes/lua-ts-mode-tests.el +++ b/test/lisp/progmodes/lua-ts-mode-tests.el @@ -25,6 +25,7 @@ (require 'hideshow) (require 'treesit) (require 'which-func) +(require 'elec-pair) =20 (ert-deftest lua-ts-test-indentation () (skip-unless (treesit-ready-p 'lua t)) @@ -61,6 +62,38 @@ lua-ts-test-hideshow (should (=3D 0 (length (overlays-in (point-min) (point-max))))) (hs-minor-mode -1))) =20 +;; from: electric-tests.el +(defun call-with-saved-electric-modes (fn) + (let ((saved-electric (if electric-pair-mode 1 -1)) + (saved-layout (if electric-layout-mode 1 -1)) + (saved-indent (if electric-indent-mode 1 -1)) + (blink-paren-function nil)) + (electric-pair-mode -1) + (electric-layout-mode -1) + (electric-indent-mode -1) + (unwind-protect + (funcall fn) + (electric-pair-mode saved-electric) + (electric-indent-mode saved-indent) + (electric-layout-mode saved-layout)))) + +;; from: electric-tests.el +(defmacro save-electric-modes (&rest body) + (declare (indent defun) (debug t)) + `(call-with-saved-electric-modes (lambda () ,@body))) + +(ert-deftest lua-ts-test-auto-close-block-comments () + (save-electric-modes + (with-temp-buffer + (dlet ((lua-ts-auto-close-block-comments t)) + (electric-pair-mode 1) + (lua-ts-mode) + (insert "--") + (let ((last-command-event ?\[)) + (ert-simulate-command '(self-insert-command 1)) + (ert-simulate-command '(self-insert-command 1))) + (should (equal "--[[\n]]" (buffer-string))))))) + (provide 'lua-ts-mode-tests) =20 ;;; lua-ts-mode-tests.el ends here --=20 2.50.1 --=-=-= Content-Type: text/plain -- - E.G via Gnus and Org. --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 09 06:45:10 2025 Received: (at 79047-done) by debbugs.gnu.org; 9 Aug 2025 10:45:10 +0000 Received: from localhost ([127.0.0.1]:40345 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ukh4X-0000TX-Tw for submit@debbugs.gnu.org; Sat, 09 Aug 2025 06:45:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53364) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ukh4U-0000NI-Bh for 79047-done@debbugs.gnu.org; Sat, 09 Aug 2025 06:45:07 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ukh4N-0004mv-Pc; Sat, 09 Aug 2025 06:45:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=2KyqkoTzEl6JahgDgtt3qHryzSwmzHUkKpTPMuddjlE=; b=H6tg3xl9M1hACwPcX5cC tJut67c20TUwLO2/hTU5GoFmCbQw5l4iBl9foX2cdnNdUML1ug+G6kBGpZDlosCV1x6ODpI93i9/G fe86vjxKAZkp/LeZ18vUQdaRsV1lX9e3CvgnxU1K3sT8tl1ItYjja6bxyFOMgpR9My6B6Ve/ClC6z Iq54yDLH9THbHrqZTLLe6Gj8zGZ1J3ZjPVtblpZAsM1fIprjNiqfT8sGjZcGGhbmPlCoURrtutHmA 1z4Dvy2QUtj0NCEaZYiKO9g/rwAiipBL8ccMFOx+6BWqybPAC8mLx52AKeqOtIRHRz358BlJTkyCI yvgVWHbdb2oznQ==; Date: Sat, 09 Aug 2025 13:44:56 +0300 Message-Id: <86bjoon593.fsf@gnu.org> From: Eli Zaretskii To: Elijah Gabe =?utf-8?Q?P=C3=A9rez?= In-Reply-To: <8734a2xtk0.fsf@gmail.com> (message from Elijah Gabe =?utf-8?Q?P=C3=A9rez?= on Thu, 07 Aug 2025 23:37:35 -0600) Subject: Re: bug#79047: Add some multi-character pairs to some major modes. References: <87ms91gcmb.fsf@gmail.com> <867c04fzpv.fsf@gnu.org> <87ecu7vneh.fsf@gmail.com> <86v7n5rfic.fsf@gnu.org> <87v7n2yhu9.fsf@gmail.com> <86ectnqnir.fsf@gnu.org> <8734a2xtk0.fsf@gmail.com> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 79047-done Cc: 79047-done@debbugs.gnu.org, acm@muc.de, jm@pub.pink, monnier@iro.umontreal.ca X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Elijah Gabe Pérez > Cc: 79047@debbugs.gnu.org, acm@muc.de, jm@pub.pink, monnier@iro.umontreal.ca > Date: Thu, 07 Aug 2025 23:37:35 -0600 > > >> Here is the patch: > > > > Thanks. It LGTM, but why isn't the change in Texinfo called out in > > NEWS, like you did with lua-ts-mode? > > I'm not sure it needs to be in NEWS, it's a very small change. In > lua-ts-mode I announced it because it uses a new option to enable the > feature. > > However if it needs to be in NEWS, here is a patch which includes it: Thanks, installed on the master branch and closing the bug. (Please in the future make sure to mention the bug number in the commit log messages.)