GNU bug report logs - #79985
[PATCH] Allow extra key bindings in ispell command loop

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: "Paul D. Nelson" <ultrono@HIDDEN>; Keywords: patch; dated Wed, 10 Dec 2025 21:17:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 79985 <at> debbugs.gnu.org:


Received: (at 79985) by debbugs.gnu.org; 12 Dec 2025 07:24:01 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Dec 12 02:24:01 2025
Received: from localhost ([127.0.0.1]:53277 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vTxVP-0000Wf-8I
	for submit <at> debbugs.gnu.org; Fri, 12 Dec 2025 02:24:00 -0500
Received: from mout-p-103.mailbox.org ([80.241.56.161]:45492)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1vTxVK-0000UO-M5
 for 79985 <at> debbugs.gnu.org; Fri, 12 Dec 2025 02:23:56 -0500
Received: from smtp102.mailbox.org (smtp102.mailbox.org
 [IPv6:2001:67c:2050:b231:465::102])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
 (No client certificate requested)
 by mout-p-103.mailbox.org (Postfix) with ESMTPS id 4dSLXx72fKz9t7D;
 Fri, 12 Dec 2025 08:23:45 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linkov.net; s=MBO0001; 
 t=1765524226;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 in-reply-to:in-reply-to:references:references;
 bh=hm4Cm5dTtwlDFTaooN7135LDXN124QV2auFBPUAuvew=;
 b=er1oXuQZp1lONi4j8x/9Oj2s7uKqeDgBcBvcamijdi+QpkhQRI5Okf/NDYBtWZySwK+8OS
 YKAH9jaN+X+yJIm3jQMtMJvaCOSqtr4CppwapqXH2ECTf4SSCcqsucQVLgr/OIhOWjT5J0
 j8x1tlcJcfm7lxjtv1AbFmu7K7j987r5H2YKzHJWWKxryjSMWXjHb8Q/4vTSIfvJQFDFjp
 v9Hd4WOd2Oa6ZifsDSkZSVlOKXpPs1mJOsODiYJDvmWKYnnlwQmvXv3XY3PF8Ul503WdZB
 JKYjqeGooEAiJ3Aclk86PfOl0esHyXx3kaHxq3C/aje6C6MtQTnBU9G4uCIkLQ==
Authentication-Results: outgoing_mbo_mout; dkim=none;
 spf=pass (outgoing_mbo_mout: domain of juri@HIDDEN designates
 2001:67c:2050:b231:465::102 as permitted sender)
 smtp.mailfrom=juri@HIDDEN
From: Juri Linkov <juri@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#79985: [PATCH] Allow extra key bindings in ispell command loop
In-Reply-To: <86ecp0c21r.fsf@HIDDEN>
Organization: LINKOV.NET
References: <uxsg7t7bus6hi3.fsf@HIDDEN> <86ecp0c21r.fsf@HIDDEN>
Date: Fri, 12 Dec 2025 09:19:17 +0200
Message-ID: <87y0n8ch2a.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Rspamd-Queue-Id: 4dSLXx72fKz9t7D
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 79985
Cc: 79985 <at> debbugs.gnu.org, Sean Whitton <spwhitton@HIDDEN>,
 Stefan Monnier <monnier@HIDDEN>,
 "Paul D. Nelson" <ultrono@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

> Can't we have an easier solution?

A cleaner solution would be to add an intermediate map
like 'query-replace-map' with the same handling at the end:

  ((commandp def t)
   (call-interactively def))




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#79985; Package emacs. Full text available.

Message received at 79985 <at> debbugs.gnu.org:


Received: (at 79985) by debbugs.gnu.org; 11 Dec 2025 22:52:52 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Dec 11 17:52:52 2025
Received: from localhost ([127.0.0.1]:49396 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vTpWl-0003Qp-KT
	for submit <at> debbugs.gnu.org; Thu, 11 Dec 2025 17:52:51 -0500
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:59239)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <monnier@HIDDEN>)
 id 1vTpWj-0003QV-7n
 for 79985 <at> debbugs.gnu.org; Thu, 11 Dec 2025 17:52:49 -0500
Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 27145441BC9;
 Thu, 11 Dec 2025 17:52:43 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1765493562;
 bh=q0e0R8+a0IxgjIyWveCsb7H5496zTY5cgrQJHNACa2M=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=SBxf5jGQRbCZBGyj+Ug6fK40Gr95wdhd7LAz1pC9B2gDSx3h5fBmfXsocdLY+2aQs
 Wrift5mUeB7qigUzO7s3PBFY3iaOAbZhL3TVX2W8y6/NxvO2pTf1zwLaL5fD/9ALlq
 ruLiuNhohd5qtAmG8YzboEHPFP1sz9j4e83l2Sr9kTgp1zcnJFJQJJPd1j2k2EKFqZ
 S+RVtzaC0hYja+1RchwLa/zWlBhalijuF+TYcvF6M9zoJhTwY98NqIDPJbwgIGy4WJ
 01yZSKcTb/+94kPJpQt582EdE+zJgclImsN8DgP89qdcNXpRfqaiZ26SbehGAViXWq
 YQIoV48nCmqrg==
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id EE8D5441BC7;
 Thu, 11 Dec 2025 17:52:41 -0500 (EST)
Received: from asado (unknown [181.28.45.30])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id DC29C1207DA;
 Thu, 11 Dec 2025 17:52:40 -0500 (EST)
From: Stefan Monnier <monnier@HIDDEN>
To: "Paul D. Nelson" <ultrono@HIDDEN>
Subject: Re: bug#79985: [PATCH] Allow extra key bindings in ispell command loop
In-Reply-To: <uxsg7ta4zq5978.fsf@HIDDEN>
Message-ID: <jwvy0n8skpy.fsf-monnier+emacs@HIDDEN>
References: <uxsg7ta4zq5978.fsf@HIDDEN>
Date: Thu, 11 Dec 2025 17:52:38 -0500
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.111 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: 79985
Cc: 79985 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Regarding defvar/defcustom: I used 'defvar' because I imagined it being
> mainly of programmatic use, but happy to adjust.

I think a `defvar` is fine.  Eli just pointed out an inconsistency
between the use of `defvar` and the use of "user option".  So keep
`defvar` but call it a ... "variable".

> @@ -2419,6 +2427,9 @@ ispell-command-loop
>  		   ((= char ?\C-z)
>  		    (funcall (key-binding "\C-z"))
>  		    t)
> +		   ((assq char ispell-command-loop-extra-bindings)
> +		    (let ((handler (cdr (assq char ispell-command-loop-extra-bindings))))
> +		      (funcall handler char miss guess word start end)))
>  		   (t (ding) t))))))
>  	  result)
>        ;; protected

As Eli pointed out, this isn't quite sufficient because the earlier code
needs to know which characters are treated specially (and which ones
are free for use by the dynamic assignment system).
I.e. you need to adjust `command-characters` at the beginning of
`ispell-command-loop` presumably by adding (mapcar #'car
ispell-command-loop-extra-bindings) to it.

Sean writes:
> 3. if not, then indeed we need to proceed very carefully to ensure the
>    hook mechanism is flexible enough, and right now it's not clear that
>    this mechanism fits the bill, without a lot more documentation.

Indeed.  A technique for that is "dogfood".  I.e. try and move most of
the code currently in the big `cond` into your new
`ispell-command-loop-extra-bindings`.  If you can move "all" of its code,
then it's a strong argument that your mechanism is probably
flexible enough.


        Stefan





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#79985; Package emacs. Full text available.

Message received at 79985 <at> debbugs.gnu.org:


Received: (at 79985) by debbugs.gnu.org; 11 Dec 2025 21:44:50 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Dec 11 16:44:50 2025
Received: from localhost ([127.0.0.1]:48916 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vToSv-0006oU-Ip
	for submit <at> debbugs.gnu.org; Thu, 11 Dec 2025 16:44:50 -0500
Received: from mail-ed1-x531.google.com ([2a00:1450:4864:20::531]:51255)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <krisbalintona@HIDDEN>)
 id 1vToSs-0006oF-RB
 for 79985 <at> debbugs.gnu.org; Thu, 11 Dec 2025 16:44:47 -0500
Received: by mail-ed1-x531.google.com with SMTP id
 4fb4d7f45d1cf-640ca678745so1005525a12.2
 for <79985 <at> debbugs.gnu.org>; Thu, 11 Dec 2025 13:44:46 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1765489481; x=1766094281; darn=debbugs.gnu.org;
 h=cc:to:subject:message-id:date:mime-version:references:in-reply-to
 :from:from:to:cc:subject:date:message-id:reply-to;
 bh=5CFoMnniv8CO5HCSSatHOmmsFpGlVCfbhvX66USqICU=;
 b=ZfYd62youB3ljsBeXLbh4RcwEq5G6TqupAZtWZS0R7npr5UgWhfBXr0sLZR4mccK0b
 fitImTHnxE2g+bUuYdhC7usOHfX57b9NAZJHWHbPoLMpzy244vnz/EYbbBhXMrX/aOdN
 Xg8tBxJi4WJjpBRoLcWOtB9H3ydp05Si3Dq02l5Btt12+OZJiCsfJrEskpimr4w0vyQp
 js18L2QragQJng5I43b6GwEZgD/m6rRD757N6j+xCSEbdFvCldYuHO0C4rMzOKM0hZX5
 z5ek4YAgTpV/VekFPSOPH50siugnaxiMGlCMxy8Z2jcFzKFwlobXPHCzACkoddPLwa0k
 x4aw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1765489481; x=1766094281;
 h=cc:to:subject:message-id:date:mime-version:references:in-reply-to
 :from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id
 :reply-to;
 bh=5CFoMnniv8CO5HCSSatHOmmsFpGlVCfbhvX66USqICU=;
 b=IP+u9hE5e5QpIuVgRaBIQQba/lvkvOdQYGQZW97sGPgCyNz0/S1WGoQIpIZaS9rBkF
 58XZJNY6cPARCzZJZ/a/I+eI1yTJj+pnQdbX/viBPMPn4wEWzhYBdbX9lX9PoK9u8OVz
 YvBRypQJEQNv2MBL3fC6T3yrnzUVuG4+3kkm9OnVBFurGHSnkAG5GCAjoozRZ84mdrlQ
 E2lvfaI4g75TrTbLvqp8O6TJT9m2mTzGL9f695Xr5tnK7rFKzay3OEhp4O4T+OKUvo9U
 mixJajiozUoCLowPiRZLG0Zn8T1li492fmbj6CUxrnkGHMoGUdjuKOHkIuHl+6H/Dv2H
 ZyuA==
X-Gm-Message-State: AOJu0YwCL53M8aOAYZsBGKd6vr92hKcWc5J+NaJMixBVF9WqxXkuxQiS
 AbtsoCDNNnKUld2tN14/U3a0i7AlrzOsHW+X8nNCPwgbitZqpc8zmo4iownsQBVO/RbeEPyVMcu
 HC1ZToLoVp9Nq8P1F+NfwUZOXjdyL3VU=
X-Gm-Gg: AY/fxX4oqMU3zb+HRAcLCJLrwluLFeOjhG0SzPbnKl3Js3XMVq2fLX7V7h/dKMb2vTD
 CnPmXSHS/ZWzZtEnUXK1i/T28Uylc5HFxsDrYHm0ABHcjtLdycL0cNwANUAmhGjVep1Nwe+r4EM
 YEWdD2UUxIf4Lr+V/lguCAX0jlohU+esneXxgmyR/RahD1mJTCko9kBr/0R9eyUuv8XzJ9LQ2Hz
 ocz94DvzV/mIVl1L5sJVnuayGikJbxMgXZVKwAvyIPhNcUeqiyTJh8/LESe0D39kWn78QM=
X-Google-Smtp-Source: AGHT+IEgyCgocb+ojw61tZq5w7g/Q95tfXuKMmkppQ0fp0kVIM4c6jMy1ywC5n7wJGBU6QnAqZeRABWNsqSGiP9fXCo=
X-Received: by 2002:a05:6402:34d1:b0:649:5d3b:db3a with SMTP id
 4fb4d7f45d1cf-6496cb4c56bmr6676421a12.8.1765489480445; Thu, 11 Dec 2025
 13:44:40 -0800 (PST)
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Thu, 11 Dec 2025 13:44:39 -0800
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Thu, 11 Dec 2025 13:44:39 -0800
From: Kristoffer Balintona <krisbalintona@HIDDEN>
In-Reply-To: <86ecp0c21r.fsf@HIDDEN>
References: <uxsg7t7bus6hi3.fsf@HIDDEN> <86ecp0c21r.fsf@HIDDEN>
MIME-Version: 1.0
Date: Thu, 11 Dec 2025 13:44:39 -0800
X-Gm-Features: AQt7F2qebZXKuEuRLdETjslYxItqouh5CHW3Rbqnc8zjOZ6ECtKb2lrcHBgNxPc
Message-ID: <CANVbq5nb9kJm8Kn-36yWzVdcK-aNpkNkUbL55YaEsDjUtG6-1g@HIDDEN>
Subject: Re: bug#79985: [PATCH] Allow extra key bindings in ispell command loop
To: Eli Zaretskii <eliz@HIDDEN>, "Paul D. Nelson" <ultrono@HIDDEN>, 
 Stefan Monnier <monnier@HIDDEN>,
 Sean Whitton <spwhitton@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 79985
Cc: 79985 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On Thu, Dec 11 2025, Eli Zaretskii wrote:

>> From: "Paul D. Nelson" <ultrono@HIDDEN>
>> Cc: 79985 <at> debbugs.gnu.org
>> Date: Thu, 11 Dec 2025 18:44:04 +0100
>>
>> Thanks, I'll incorporate your comments, but maybe this point is worth
>> clarifying first:
>>
>> > TBH, those missing details could also be useful for discussing this
>> > feature, because I'm not yet sure it is indeed the best idea for what
>> > you had in mind (which I'm admittedly guessing, since you haven't
>> > described that).
>>
>> I have in my config a command that
>>
>> (1) looks backward in the visible buffer for a misspelled word,
>> (2) corrects it using ispell, and
>> (3) saves the correction to the abbrev table, so that it autocorrects in
>>     the future.
>>
>> Most of the time, step (3) is desired, but occasionally I want to skip
>> it, and I only know this after seeing the proposed correction in the
>> ispell command loop.  So I need a way to communicate my preference from
>> the command loop back to the calling function.  The simplest way I could
>> think of was to add a command to the loop that sets some global flag.
>>
>> My current implementation (via :override advice) is available at
>>
>>   https://github.com/ultronozm/czm-spell.el/blob/main/czm-spell.el
>>
>> The patch is an attempt to replace the advice with a generic extension
>> point.
>
> If we want to support an optional update of the abbrev table, we could
> have a simpler implementation.  If, OTOH, we want to provide a much
> more general way of customizing the ispell command loop, we need to
> have a more thorough discussion about the design.  For starters the
> commands offered by ispell include characters that indicate which
> candidate for correction to use, and those are computed dynamically.
> So how would the user who is coding such a customization know up front
> which characters will be free for use?  And what will FUNCTION in your
> proposed data structure need to do? will it need to perform a
> replacement and then save the correction into the abbrevs, for
> example?  Such a function is not really trivial to write, am I right?
>
> Can't we have an easier solution?  Like perhaps add a new hook to be
> run by the ispell command loop after correcting a word?

IMO we could, if anything, just implement the abbrev functionality that
Paul sought into ispell itself.[1] Flyspell already has a similar
feature, so it might be reasonable to do the same with ispell.

Paul wanted a certain feature in the command loop, which is what drove
him to extend `ispell-command-loop'. But I think a better way to address
the problem would be to add the common features that users seek directly
into the command loop, instead of letting them hack onto the command
loop (partially because of the technical reasons Eli described).

I think if users had a lot of custom functionality they wanted from
ispell, we should consider making the command loop more hackable. But
from my observations of existing word correction/spell checking packages
(flyspell, jinx.el, jit-spell, flyspell-correct, etc.), there isn't much
demand for features aside from (i) adding words to one's personal
dictionary, (ii) adding words to a buffer-local list, (iii) maybe adding
words to one's abbrev lists, and (iv) maybe adding words to a
directory/project-local list. As such, I think directly implementing
desired features upstream is the approach to take.


Footnotes:
[1] This would cover (3) in Paul's list, with (2) is what ispell already
     does.

-- 
Kind regards,
Kristoffer




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#79985; Package emacs. Full text available.

Message received at 79985 <at> debbugs.gnu.org:


Received: (at 79985) by debbugs.gnu.org; 11 Dec 2025 20:42:25 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Dec 11 15:42:25 2025
Received: from localhost ([127.0.0.1]:48382 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vTnUX-0001p5-3F
	for submit <at> debbugs.gnu.org; Thu, 11 Dec 2025 15:42:25 -0500
Received: from sendmail.purelymail.com ([34.202.193.197]:44816)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <spwhitton@HIDDEN>)
 id 1vTnUT-0001og-S0
 for 79985 <at> debbugs.gnu.org; Thu, 11 Dec 2025 15:42:22 -0500
DKIM-Signature: a=rsa-sha256;
 b=L4Q1a5P3qEHo7viFw7ruzR27+9qQ/JCIlVJXK94pcZH7pGfUVG2tMOKHCiP22PoNrHBRm60BFZ8dpYttxZENAfUmM6L0KQHoXlhRY15UYNOiWkrHxVCag+q7yWqJyOpRqQYXX+abNZJobRoQt7NDs25A/7P9GsZeaRkJKp/yF4FaIIX9pqBcjAdRghbuDr8a/pvwmy8ZrOKxqmrWUtgBDYSezNg7zC3Yem2AfmrmExQV1RLOXhPHbNNp04a316sSMcjQp7eD+6gXubTJeCSBG5/QGBKBX95l2vVxdwssf/g/kBsIBZ87yFzojBzorCrDqJTVmDZrYvkiuvSRp+PwPA==;
 s=purelymail1; d=spwhitton.name; v=1;
 bh=shmxM4bUVRUrSgACTwwptZSAHe8WKnXJqBS0x4kXWWc=;
 h=Received:Received:From:To:Subject:Date; 
DKIM-Signature: a=rsa-sha256;
 b=SsCX0J1b4EoHzQLxClsVt92hfyf4XSDKexvhG7AsYrAiBPEGVUs1jzpw++mX72+mBvoQhxZyDq4ZE9bZF/kwgAADxT8wINwbXPNrEfN+CmmtFWlSFb9Jb/s9yE51I4EIOhK8NoXedwQQXJYAflhYY2NphzyyIF6Yf3zCxVSxfXBzTmM+2fWBJpuQOxgk1LlUtFSsaNL/obAylaWC242KsXG0hEfri+pdhjJblaiczC59xW7Ef1vkysN0A0Uh3puxU42WyVyAiyvBlKP/Gm7nTgs6Xy6IaBxDmmhWVzO4poa2Df8Ntij+QMLU3EpKZqAs7PO3JNmDICW+F5Qua3L52Q==;
 s=purelymail1; d=purelymail.com; v=1;
 bh=shmxM4bUVRUrSgACTwwptZSAHe8WKnXJqBS0x4kXWWc=;
 h=Feedback-ID:Received:Received:From:To:Subject:Date; 
Feedback-ID: 20115:3760:null:purelymail
X-Pm-Original-To: 79985 <at> debbugs.gnu.org
Received: by smtp.purelymail.com (Purelymail SMTP) with ESMTPSA id 507663390; 
 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384);
 Thu, 11 Dec 2025 20:42:13 +0000 (UTC)
Received: by zephyr.silentflame.com (Postfix, from userid 1000)
 id 827C3940498; Thu, 11 Dec 2025 20:42:12 +0000 (GMT)
From: Sean Whitton <spwhitton@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>, "Paul D. Nelson" <ultrono@HIDDEN>,
 Stefan Monnier <monnier@HIDDEN>,  79985 <at> debbugs.gnu.org
Subject: Re: bug#79985: [PATCH] Allow extra key bindings in ispell command loop
In-Reply-To: <86ecp0c21r.fsf@HIDDEN>
References: <uxsg7t7bus6hi3.fsf@HIDDEN> <86ecp0c21r.fsf@HIDDEN>
Date: Thu, 11 Dec 2025 20:42:12 +0000
Message-ID: <878qf84uor.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 79985
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hello,

On Thu 11 Dec 2025 at 08:21pm +02, Eli Zaretskii wrote:

> I don't quite understand how can we expect users to write custom
> commands which will DTRT as part of the ispell command loop.  Isn't
> that quite a complex job for a user customization? why cannot one or
> more hooks provide an ample opportunity for customizing ispell?
>
> I'm interested to hear what Stefan and Sean think about this.  And
> anyone else who has an opinion or ideas for how to design and
> implement this kind of extension.

I haven't hacked on Ispell so this might be naive, but maybe a way to
provide a whole custom command loop would be simpler than a way to
insert additional bindings into the existing loop?  There could be
functions a custom command loop could call to ask Ispell to say whether
a word is misspelt and return its suggestions for the correct spelling,
and then the custom loop would decide how to present these to the user.

In general though I agree that we should proceed in this order:

1. whether this is a useful feature we should just implement upstream
   for everyone's use

2. if not, whether some easier-to-understand hooks would do the job

3. if not, then indeed we need to proceed very carefully to ensure the
   hook mechanism is flexible enough, and right now it's not clear that
   this mechanism fits the bill, without a lot more documentation.

-- 
Sean Whitton




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#79985; Package emacs. Full text available.

Message received at 79985 <at> debbugs.gnu.org:


Received: (at 79985) by debbugs.gnu.org; 11 Dec 2025 18:21:33 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Dec 11 13:21:33 2025
Received: from localhost ([127.0.0.1]:47212 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vTlID-0008Fc-5J
	for submit <at> debbugs.gnu.org; Thu, 11 Dec 2025 13:21:33 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:32906)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1vTlI8-0008Du-UQ
 for 79985 <at> debbugs.gnu.org; Thu, 11 Dec 2025 13:21:30 -0500
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 <eliz@HIDDEN>)
 id 1vTlI3-0003l0-3M; Thu, 11 Dec 2025 13:21:23 -0500
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=DqsyYSpTMkcLF3y7zSGTE8G1GvYVr3EDlK+OSJz2bew=; b=R6i523cC7vnD
 K4FWtfMUq43o10ZM/7P433aRibyeShazioZ+YelbONM+NQWq9ntadZaRIyzQacSTD2K4jZHtkhetr
 VajxHeQfmhwmpxMG6Ln0/HpU4bh0kOyIRbESof8v9p0zoMIFnTl317e0fxY1RqYJw51euNYsoGCO5
 luYHfhjo6PDncuC6sLExUScqGzNlfoLzaHlaY3pCtBDIgK+hcI9USSVfnJosPnISIJ7Xl8UfL1bY4
 Pb09IpyxIA+eYYMwnbf/8JgUvP6DcangEAiPkC1+iEt0GffH8SmrJ2/EmecsbJICqSFqr6WS5rcXo
 vjQDX+UFVrGSrC5l++AZGQ==;
Date: Thu, 11 Dec 2025 20:21:20 +0200
Message-Id: <86ecp0c21r.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: "Paul D. Nelson" <ultrono@HIDDEN>,
 Stefan Monnier <monnier@HIDDEN>,
 Sean Whitton <spwhitton@HIDDEN>
In-Reply-To: <uxsg7t7bus6hi3.fsf@HIDDEN> (ultrono@HIDDEN)
Subject: Re: bug#79985: [PATCH] Allow extra key bindings in ispell command loop
References: <uxsg7t7bus6hi3.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 79985
Cc: 79985 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: "Paul D. Nelson" <ultrono@HIDDEN>
> Cc: 79985 <at> debbugs.gnu.org
> Date: Thu, 11 Dec 2025 18:44:04 +0100
> 
> Thanks, I'll incorporate your comments, but maybe this point is worth
> clarifying first:
> 
> > TBH, those missing details could also be useful for discussing this
> > feature, because I'm not yet sure it is indeed the best idea for what
> > you had in mind (which I'm admittedly guessing, since you haven't
> > described that).
> 
> I have in my config a command that
> 
> (1) looks backward in the visible buffer for a misspelled word,
> (2) corrects it using ispell, and
> (3) saves the correction to the abbrev table, so that it autocorrects in
>     the future.
> 
> Most of the time, step (3) is desired, but occasionally I want to skip
> it, and I only know this after seeing the proposed correction in the
> ispell command loop.  So I need a way to communicate my preference from
> the command loop back to the calling function.  The simplest way I could
> think of was to add a command to the loop that sets some global flag.
> 
> My current implementation (via :override advice) is available at
> 
>   https://github.com/ultronozm/czm-spell.el/blob/main/czm-spell.el
> 
> The patch is an attempt to replace the advice with a generic extension
> point.

If we want to support an optional update of the abbrev table, we could
have a simpler implementation.  If, OTOH, we want to provide a much
more general way of customizing the ispell command loop, we need to
have a more thorough discussion about the design.  For starters the
commands offered by ispell include characters that indicate which
candidate for correction to use, and those are computed dynamically.
So how would the user who is coding such a customization know up front
which characters will be free for use?  And what will FUNCTION in your
proposed data structure need to do? will it need to perform a
replacement and then save the correction into the abbrevs, for
example?  Such a function is not really trivial to write, am I right?

Can't we have an easier solution?  Like perhaps add a new hook to be
run by the ispell command loop after correcting a word?

> > Please enhance the documentation to explain when and how this variable
> > could be useful to users.
> 
> The intent is to provide a generic way to add custom commands to the
> ispell command loop.  This can be used, for instance, when some Lisp
> code needs to communicate user choices from the loop back to the calling
> function.

I don't quite understand how can we expect users to write custom
commands which will DTRT as part of the ispell command loop.  Isn't
that quite a complex job for a user customization? why cannot one or
more hooks provide an ample opportunity for customizing ispell?

I'm interested to hear what Stefan and Sean think about this.  And
anyone else who has an opinion or ideas for how to design and
implement this kind of extension.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#79985; Package emacs. Full text available.

Message received at 79985 <at> debbugs.gnu.org:


Received: (at 79985) by debbugs.gnu.org; 11 Dec 2025 17:44:15 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Dec 11 12:44:15 2025
Received: from localhost ([127.0.0.1]:46985 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vTki7-0005i0-9s
	for submit <at> debbugs.gnu.org; Thu, 11 Dec 2025 12:44:15 -0500
Received: from mail-ed1-x52f.google.com ([2a00:1450:4864:20::52f]:43434)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <ultrono@HIDDEN>) id 1vTki4-0005hi-Qv
 for 79985 <at> debbugs.gnu.org; Thu, 11 Dec 2025 12:44:13 -0500
Received: by mail-ed1-x52f.google.com with SMTP id
 4fb4d7f45d1cf-640e9f5951aso535877a12.1
 for <79985 <at> debbugs.gnu.org>; Thu, 11 Dec 2025 09:44:12 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1765475046; x=1766079846; darn=debbugs.gnu.org;
 h=mime-version:message-id:date:in-reply-to:subject:cc:to:from:from:to
 :cc:subject:date:message-id:reply-to;
 bh=EdcYD22lOnTvBt29Wfd081dMZSj7Vg71tlTlq9YIkmA=;
 b=gfMsrR+BGK4UOgOrwMWl+fAgl9WEXXFhhF1FUVqRp1R0KTXydhEv6EbLBTvP/SSsHT
 lB0LT+aZUMsn6NQNJ5zrfnPi+CQ8jIkws8E8eWeWtFxcNyle02Jg1pNjNZmUONWMMnXp
 RhckYM1yD3aFt77+1omOJ1WSYTOp4uP/dqHqaj9lEgLMmpMRGl+BiS5ykbLnHEQvrOgT
 /1FFH+RMs5Tn7tCx4FDaGmNgs3p4XCspC64KHAqpmCv3S8sdsNWHuRpXRrY1ypWhJcY+
 Zt2v/t5J+JVs+vbzEOJRd8Ecm/Jto//PhNloWlp45UVXsRYD5k2efiqLYpsBGSjD6iRX
 BL5w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1765475046; x=1766079846;
 h=mime-version:message-id:date:in-reply-to:subject:cc:to:from:x-gm-gg
 :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=EdcYD22lOnTvBt29Wfd081dMZSj7Vg71tlTlq9YIkmA=;
 b=kDL1Fv5oSi3tT2gGZn6mCZUt34wRmvL+QyewfIS/EJPPjEHSqSbDmdVxMSPfjrnniA
 wZuzcJBVoSlxzlyIvxIdCDQ53KNUxpSkESrZ62+C37XWy7g+bFIF2z66JXmWqmsmpd8g
 NpLuMpl0cGsl+G6wlroBxirIRqVf2UXzP31C6mbk/btTQ2y8w0EZT5TD0QfNnJC/TxkC
 O8/xTIZsCI7qSkXbXHQkNeTn8TiXpVOy5oNnCJLlr/iPLQDmrgj5hqE+oqwma0mFkS51
 Q6Gc+wI6oVgMOxMVk4qTO7Yhidv3LvwA8zp6OK6wyGk8IekkuiC/EJtU1yFPxSRonwMs
 4yeQ==
X-Gm-Message-State: AOJu0YxEmKNPx2CUDqqGfSkIcsORMJK6MA2WMBWtZPznj9z/nNaDwoyV
 rNuSFHFvFv/OMd7yRwyCfRCwHb4+Qbm7TO3pbZ0EMTljmWkhg3cnlRnohy6afg==
X-Gm-Gg: AY/fxX5vXnjf8yp36qh/WAJgPkIfhuQNtAbLE0iOoEUQTt5thbA6vJqpRHKmQEAsKnX
 gTZT5UZvLoGF6bB5COHViM2NUZet66akdkmxxCA1rIhLW18Ryh+QJecRmlDSELSEpLAlRR25SXW
 m8+Mu0jUrv/sWtAusBeVCOv91HTeOixUgFZWh3MQpuuvPdk2kvtfb2VY+Qqc7q0UQ78bcXvy3eV
 HsqXRSSse6SImf6ioPQA2fmLwK+bSVcb7XzgIb1+2nMDsLNgm09JbBhkNGGsc06xjbnKAzZGkmD
 iN/RyYk9VYu3K0ouRUyifXPDHe9XCnG3klW3j/sdvSpq9lTSuB8zV+ErBGVc+yLE/LeIDCALt5q
 n/XZ0gbPZVxLk2mMEmBVxAsWXbvT+hVC8ByfhqjvX9PPSbe1x1+o8XEXfrcISeWr+uRrjAuzWRk
 3UAtip2t4GmyO5RA==
X-Google-Smtp-Source: AGHT+IHb45JoaXmwuYgoUYIoalDa69glER53YeCW/68pmE41egCWAA/qf+K7t53pNyZQoyRz0PesOA==
X-Received: by 2002:a17:907:d07:b0:b70:b9fe:aa56 with SMTP id
 a640c23a62f3a-b7d02b165bfmr356857066b.20.1765475045764; 
 Thu, 11 Dec 2025 09:44:05 -0800 (PST)
Received: from localhost ([130.225.21.26]) by smtp.gmail.com with UTF8SMTPSA id
 a640c23a62f3a-b7cfa29e084sm369483366b.7.2025.12.11.09.44.04
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 11 Dec 2025 09:44:05 -0800 (PST)
From: "Paul D. Nelson" <ultrono@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#79985: [PATCH] Allow extra key bindings in ispell command loop
In-Reply-To: <86tsxxbgco.fsf@HIDDEN> (message from Eli Zaretskii on Thu, 11
 Dec 2025 09:57:43 +0200)
Date: Thu, 11 Dec 2025 18:44:04 +0100
Message-ID: <uxsg7t7bus6hi3.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 79985
Cc: 79985 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Thanks, I'll incorporate your comments, but maybe this point is worth
clarifying first:

> TBH, those missing details could also be useful for discussing this
> feature, because I'm not yet sure it is indeed the best idea for what
> you had in mind (which I'm admittedly guessing, since you haven't
> described that).

I have in my config a command that

(1) looks backward in the visible buffer for a misspelled word,
(2) corrects it using ispell, and
(3) saves the correction to the abbrev table, so that it autocorrects in
    the future.

Most of the time, step (3) is desired, but occasionally I want to skip
it, and I only know this after seeing the proposed correction in the
ispell command loop.  So I need a way to communicate my preference from
the command loop back to the calling function.  The simplest way I could
think of was to add a command to the loop that sets some global flag.

My current implementation (via :override advice) is available at

  https://github.com/ultronozm/czm-spell.el/blob/main/czm-spell.el

The patch is an attempt to replace the advice with a generic extension
point.

> Please enhance the documentation to explain when and how this variable
> could be useful to users.

The intent is to provide a generic way to add custom commands to the
ispell command loop.  This can be used, for instance, when some Lisp
code needs to communicate user choices from the loop back to the calling
function.

Regarding defvar/defcustom: I used 'defvar' because I imagined it being
mainly of programmatic use, but happy to adjust.

If that sounds reasonable, I'll send an updated patch addressing your
comments.  Other suggestions would of course be welcome.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#79985; Package emacs. Full text available.

Message received at 79985 <at> debbugs.gnu.org:


Received: (at 79985) by debbugs.gnu.org; 11 Dec 2025 07:57:54 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Dec 11 02:57:54 2025
Received: from localhost ([127.0.0.1]:41341 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vTbYg-0006VM-4n
	for submit <at> debbugs.gnu.org; Thu, 11 Dec 2025 02:57:54 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:60740)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1vTbYd-0006Ux-Cn
 for 79985 <at> debbugs.gnu.org; Thu, 11 Dec 2025 02:57:52 -0500
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 <eliz@HIDDEN>)
 id 1vTbYX-0007XP-To; Thu, 11 Dec 2025 02:57:45 -0500
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=Cda8EKjjk3C02/MfyyMPlVdWsSX4jRhZbVIfFP7M4GQ=; b=LfRZmov2FMGW
 3RfkytHcLA0ZBdVU9hLcljTnXSYMJF08y0FB9GZjVkCpfPZgDjzHiCIm0Osk7h44AY+T9cVUJ+ZSq
 v1N93ityrPSyHLIbz+HiJGqiE1OeHmB/+WkIo2LyChs+bOcGth7LsECxR0nfO2YyV/PwFQD9g431t
 QuweLHiD528P4GXLTYH+WRl+Afjudh+pIVoltOTrdE5WUF6rwd6toL+EKjskKwnW8J/fC6wMJYbYI
 6vUMQSVDzdftuXACTxKuZI5qnXNuUmI0pTdb9EzltivRNa81bcwSmnhfxZT4tixLcuOdZzyoh8syY
 0B0SOeaBBGDmhp1hMlQHwQ==;
Date: Thu, 11 Dec 2025 09:57:43 +0200
Message-Id: <86tsxxbgco.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: "Paul D. Nelson" <ultrono@HIDDEN>
In-Reply-To: <uxsg7ta4zq5978.fsf@HIDDEN> (ultrono@HIDDEN)
Subject: Re: bug#79985: [PATCH] Allow extra key bindings in ispell command loop
References: <uxsg7ta4zq5978.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 79985
Cc: 79985 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: "Paul D. Nelson" <ultrono@HIDDEN>
> Date: Wed, 10 Dec 2025 22:16:27 +0100
> 
> This patch adds a variable that allows extra bindings in the ispell
> command loop.

Thanks, a few comments below.

> >From dafc9897fe8237490cd928af4e0d2be3516cc30b Mon Sep 17 00:00:00 2001
> From: Paul Nelson <ultrono@HIDDEN>
> Date: Mon, 1 Dec 2025 09:02:45 +0100
> Subject: [PATCH 1/1] Allow extra key bindings in ispell command loop
> 
> * lisp/textmodes/ispell.el (ispell-command-loop-extra-bindings):
> New user option.

This says "user option", but the new variable is a defvar, not a
defcustom.  A defvar is not a "user option" in our terminology.  Which
one did you intend to provide?

> +---
> +*** New defvar 'ispell-command-loop-extra-bindings'
> +This allows custom commands in the ispell command loop.

Since you didn't update the manuals, this NEWS entry and the doc
string are the only sources of documentation for this feature.  And
both are almost completely silent about the rationale and the use
cases for this variable.  Please enhance the documentation to explain
when and how this variable could be useful to users.  TBH, those
missing details could also be useful for discussing this feature,
because I'm not yet sure it is indeed the best idea for what you had
in mind (which I'm admittedly guessing, since you haven't described
that).

> +(defvar ispell-command-loop-extra-bindings nil
> +  "Alist of extra key bindings honored by `ispell-command-loop'.
> +Each element has the form (CHAR . FUNCTION).  FUNCTION is called with
> +the arguments (CHAR MISS GUESS WORD START END) and must return a
> +suitable return value for `ispell-command-loop' (such as nil, 0, t, a
> +replacement string, etc.).")

This doesn't say what is CHAR and what are the limitations on CHARs
defined by users in this data structure.  Also, please either have an
exhaustive list of possible return values for FUNCTION, or point to
another variable/function whose doc string already describes that.
Otherwise, how do we expect users to write such a FUNCTION?

>  (defun ispell-command-loop (miss guess word start end)
>    "Display possible corrections from MISS using GUESS for WORD in START..END.
>  MISS lists possible corrections.
> @@ -2162,7 +2169,8 @@ ispell-command-loop
>  Global `ispell-pdict-modified-p' becomes a list where the only value
>  indicates whether the dictionary has been modified when option `a'
>  or `i' is used.
> -Global `ispell-quit' is set to start location to continue spell session."
> +Global `ispell-quit' is set to start location to continue spell session.
> +See also `ispell-command-loop-extra-bindings'."

This "see also" is welcome, but it should tell more that just the tip
of the iceberg: how is that variable used by ispell-command-loop?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#79985; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 10 Dec 2025 21:16:48 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Dec 10 16:16:48 2025
Received: from localhost ([127.0.0.1]:36954 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vTRYF-0000k7-T7
	for submit <at> debbugs.gnu.org; Wed, 10 Dec 2025 16:16:48 -0500
Received: from lists.gnu.org ([2001:470:142::17]:41728)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <ultrono@HIDDEN>) id 1vTRYA-0000jZ-Mu
 for submit <at> debbugs.gnu.org; Wed, 10 Dec 2025 16:16:45 -0500
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 <ultrono@HIDDEN>) id 1vTRY2-000439-HY
 for bug-gnu-emacs@HIDDEN; Wed, 10 Dec 2025 16:16:35 -0500
Received: from mail-ej1-x62d.google.com ([2a00:1450:4864:20::62d])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <ultrono@HIDDEN>) id 1vTRY0-0004UO-Bs
 for bug-gnu-emacs@HIDDEN; Wed, 10 Dec 2025 16:16:33 -0500
Received: by mail-ej1-x62d.google.com with SMTP id
 a640c23a62f3a-b7277324054so46267666b.0
 for <bug-gnu-emacs@HIDDEN>; Wed, 10 Dec 2025 13:16:31 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1765401390; x=1766006190; darn=gnu.org;
 h=mime-version:message-id:date:subject:to:from:from:to:cc:subject
 :date:message-id:reply-to;
 bh=QApf6fzAVfI6nmeHdgiSWd4ZtTrRgIYjJvmCy5c2s5w=;
 b=BUZRyIHxgCuBalpqPm+wOro7xPdoCoUfwmBAfpov9Nu/iPwZ3ZWi6P7WLylELcTfSS
 MBxwEqwxaXxGgvyHP+Pp+uoOmNgWwVshJv+qqbJ79tPBdK32F/mLtMeD1YNsG7Fks6oI
 zPNkcLHZ0zzOe/MoqyYrkqFhociwaroDSxNN+Ivk9Nmcq6Wsof9bjZD0C2d8ohWvkYyN
 SSL4QUFw4xfonnfWuMZKNro7IbayHu/6OFA/H8sZbK+gehiqueSNT552nCcYiun6sWn5
 eTvcUk04zyRBR7p2gSHKdcnSv56cs2hlOWwJcsc3LhiPmwshxYgcM+wNzi1nnmv1cmRq
 1gEA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1765401390; x=1766006190;
 h=mime-version:message-id:date:subject:to:from:x-gm-gg
 :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=QApf6fzAVfI6nmeHdgiSWd4ZtTrRgIYjJvmCy5c2s5w=;
 b=GcZgsi1Dq8kOVuhOYiI3lYDV1leuBgVLM6dbUyuJP6TvODf7hpChcupMRZS2nZTK+C
 jsWoaYWC54reUAxw5D1sqzfqFIV6lFcMt3oH4zFOPIVZeGMekECOCPY+AfuodNmUUfW0
 WRV0J6ga5qW7KKlqNhQGZ1SW0qtHstMFgF0WHN9cPhYm6cIW97n2OHbtbxjNngEXIT+Z
 fYlriD/3pm/le1tIw1hswTpz49Swe8GrLfk31M4uJ3aLSJZ0CSnioRJR+ZLd9WT0uND4
 2zy2ZSJAKaZXI63wMfe2rISH2wP5BvIRDCS51xpYOw3b8zKOmS+E+MauC/0TEp1hQVkw
 X8ag==
X-Gm-Message-State: AOJu0YxMsSRyqakQpwPr5ljli7W13hzxFFRnCvbyIIgTVl8cOzjXIK9W
 YRV4peWUVreK149Zne4Sjn2YSObOD00cFh45JCJFP+UoDvc7ItoBIvKK4i62Eg==
X-Gm-Gg: AY/fxX4y4/jppjP2qloFeM8lyORLA8854zrw9IEc2sjfryyoUcssxG30H0PHrBOSazS
 4+xWBDtyGfsxeXnXkqsfkb1DTWlhi5NiM+IRuvcu/pYTT7poZURfArI2K0Lht2aJl+V2C96UDYm
 JHQO7gshrDAtkduUtRaS5FGXUhsXfUhuRLXBFNzQgEeLS4qxpxOPDjkosVHQpXdjwzj4GPmMpLZ
 beFwc9YrXyVjKEsFS4l/no2ELpgySB9S3fn/fjjhciWFchVKKfAl2aWBI9tGo55n4zCURzF8Uap
 Xw7CSgnwS+a/ZFs5WW9mmIauhaKqNxgqcJVt6RPyg5+k4gOBsMb2TbRPmXr1TliSwPTlNOIJYmB
 XPU7iBdUg3Yu+zNSuwJMALne+p8z9UzdLkn0dNpG9NyL4U2UQlvpBvJ3+zG0OKik1FRlGU9vLM+
 LPzfQdzoGcElLugg==
X-Google-Smtp-Source: AGHT+IEYoj8f/fueMgasQdCFhCOzVTRrODmZa+ZfdYg2oMteTT9lc8iWHNhkXq8OoZ1jjGC5Ap3XvA==
X-Received: by 2002:a17:907:3d94:b0:b72:b8e4:3aea with SMTP id
 a640c23a62f3a-b7ce820937bmr418350166b.10.1765401390042; 
 Wed, 10 Dec 2025 13:16:30 -0800 (PST)
Received: from localhost ([130.225.16.16]) by smtp.gmail.com with UTF8SMTPSA id
 a640c23a62f3a-b7cfa5d1e89sm56906466b.69.2025.12.10.13.16.29
 for <bug-gnu-emacs@HIDDEN>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 10 Dec 2025 13:16:29 -0800 (PST)
From: "Paul D. Nelson" <ultrono@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: [PATCH] Allow extra key bindings in ispell command loop
Date: Wed, 10 Dec 2025 22:16:27 +0100
Message-ID: <uxsg7ta4zq5978.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
Received-SPF: pass client-ip=2a00:1450:4864:20::62d;
 envelope-from=ultrono@HIDDEN; helo=mail-ej1-x62d.google.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 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_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.0 (+)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

--=-=-=
Content-Type: text/plain

This patch adds a variable that allows extra bindings in the ispell
command loop.


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=0001-Allow-extra-key-bindings-in-ispell-command-loop.patch
Content-Description: [PATCH 1/1] Allow extra key bindings in ispell command loop

From dafc9897fe8237490cd928af4e0d2be3516cc30b Mon Sep 17 00:00:00 2001
From: Paul Nelson <ultrono@HIDDEN>
Date: Mon, 1 Dec 2025 09:02:45 +0100
Subject: [PATCH 1/1] Allow extra key bindings in ispell command loop

* lisp/textmodes/ispell.el (ispell-command-loop-extra-bindings):
New user option.
(ispell-command-loop): Use it.
---
 etc/NEWS                 |  4 ++++
 lisp/textmodes/ispell.el | 13 ++++++++++++-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/etc/NEWS b/etc/NEWS
index 2f362a155bb..59fd91031f3 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1974,6 +1974,10 @@ option 'doc-view-djvused-program'.
 The default value is now 30 seconds, as the old value was too short to
 allow reading the help text.
 
+---
+*** New defvar 'ispell-command-loop-extra-bindings'
+This allows custom commands in the ispell command loop.
+
 ** Flyspell
 
 ---
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index 6476a169613..7dc50242271 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -2148,6 +2148,13 @@ ispell-update-post-hook
 It is called once per iteration, before displaying a prompt to
 the user.")
 
+(defvar ispell-command-loop-extra-bindings nil
+  "Alist of extra key bindings honored by `ispell-command-loop'.
+Each element has the form (CHAR . FUNCTION).  FUNCTION is called with
+the arguments (CHAR MISS GUESS WORD START END) and must return a
+suitable return value for `ispell-command-loop' (such as nil, 0, t, a
+replacement string, etc.).")
+
 (defun ispell-command-loop (miss guess word start end)
   "Display possible corrections from MISS using GUESS for WORD in START..END.
 MISS lists possible corrections.
@@ -2162,7 +2169,8 @@ ispell-command-loop
 Global `ispell-pdict-modified-p' becomes a list where the only value
 indicates whether the dictionary has been modified when option `a'
 or `i' is used.
-Global `ispell-quit' is set to start location to continue spell session."
+Global `ispell-quit' is set to start location to continue spell session.
+See also `ispell-command-loop-extra-bindings'."
   (let ((count ?0)
 	(choices miss)
 	(window-min-height (min window-min-height
@@ -2419,6 +2427,9 @@ ispell-command-loop
 		   ((= char ?\C-z)
 		    (funcall (key-binding "\C-z"))
 		    t)
+		   ((assq char ispell-command-loop-extra-bindings)
+		    (let ((handler (cdr (assq char ispell-command-loop-extra-bindings))))
+		      (funcall handler char miss guess word start end)))
 		   (t (ding) t))))))
 	  result)
       ;; protected
-- 
2.50.1 (Apple Git-155)


--=-=-=--




Acknowledgement sent to "Paul D. Nelson" <ultrono@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#79985; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Fri, 12 Dec 2025 07:30:03 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.