From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Word completion in text modes Date: Sat, 25 Nov 2023 12:40:36 +0200 Message-ID: <83leamcdzv.fsf@gnu.org> References: <83h6ljme0j.fsf@gnu.org> <83edgnmaqw.fsf@gnu.org> <837cmfm30o.fsf@gnu.org> <834jhina3v.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13290"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Eshel Yaron Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Nov 25 11:41:48 2023 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1r6q6d-0003Gn-Nz for ged-emacs-devel@m.gmane-mx.org; Sat, 25 Nov 2023 11:41:47 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r6q5l-0007ux-Pe; Sat, 25 Nov 2023 05:40:53 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r6q5g-0007ue-UF for emacs-devel@gnu.org; Sat, 25 Nov 2023 05:40:49 -0500 Original-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 1r6q5a-0002xi-21; Sat, 25 Nov 2023 05:40:48 -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=B9x+JdSOVpHWhWXTS0yPJ7tYOOwaZUmuA1EeyIlU+S0=; b=U6SqCFXnM6UL fJ/sQgg2x4MUwtGiiBWtuRLjo8jKqZEJeY/AMJYSi5F9PvrvJ7vnq5EO2o6BDsDt5Gve7FbFPzXKs xzZnhBCJXoWLpxfipMwFiwvBPnl4xYGwArdjTH7Z4pPkGMzLiKQOzEqKuuvalqLhqU1DN6EnE3IqM J/liqtjxJy0mo35gIRaDBYuqfIE/bHYKqEtFUL3LYL5JPRY/Nm0kfDiZ7YVlUL0FyZ9pMcT57NQ5T UTT7gUcHiWofCLmLNTIANMMHg7p5No8y3LIzVt6HUyfC9n5HI7VjOwfmuY/TDjvsigg1/20NZ0BIe un5rBHmtKbzaPwlmrbhCgg==; In-Reply-To: (message from Eshel Yaron on Tue, 21 Nov 2023 14:45:01 +0100) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:313203 Archived-At: > From: Eshel Yaron > Cc: emacs-devel@gnu.org > Date: Tue, 21 Nov 2023 14:45:01 +0100 > > Eli Zaretskii writes: > > > I'd prefer a solution that didn't require key bindings. Something > > like a user option. > > That'd indeed be more convenient for some users, I suppose. > I'm attaching below a patch that facilitates using `completion-at-point` > in Text mode instead of `ispell-complete-word` by default. Other than > the somewhat awkward name of the user option that restores the binding, > I'm pretty happy with this patch as it brings about the three benefits I > outlined in my original message in this thread. WDYT? See some comments below. > diff --git a/doc/emacs/fixit.texi b/doc/emacs/fixit.texi > index 78503d31a38..51814ab30e0 100644 > --- a/doc/emacs/fixit.texi > +++ b/doc/emacs/fixit.texi > @@ -292,11 +292,6 @@ Spelling > Restart the spell-checker process, using @var{dict} as the dictionary. > @item M-x ispell-kill-ispell > Kill the spell-checker subprocess. > -@item M-@key{TAB} > -@itemx @key{ESC} @key{TAB} > -@itemx C-M-i > -Complete the word before point based on the spelling dictionary > -(@code{ispell-complete-word}). > @item M-x flyspell-mode > Enable Flyspell mode, which highlights all misspelled words. > @item M-x flyspell-prog-mode > @@ -398,14 +393,11 @@ Spelling > Show the list of options. > @end table > > -@findex ispell-complete-word > - In Text mode and related modes, @kbd{M-@key{TAB}} > -(@code{ispell-complete-word}) performs in-buffer completion based on > -spelling correction. Insert the beginning of a word, and then type > -@kbd{M-@key{TAB}}; this shows a list of completions. (If your > + Use the command @kbd{M-@key{TAB}} (@code{completion-at-point}) to > +complete the word at point. Insert the beginning of a word, and then > +type @kbd{M-@key{TAB}} to select from a list of completions. (If your > window manager intercepts @kbd{M-@key{TAB}}, type @w{@kbd{@key{ESC} > -@key{TAB}}} or @kbd{C-M-i}.) Each completion is listed with a digit or > -character; type that digit or character to choose it. > +@key{TAB}}} or @kbd{C-M-i}.) The removal of the command from the summary violates our conventions in such sections: we first show a summary of the commands described by the section, and then have their full description. So please don't remove the command from the summary; instead, change the description and the command name to follow the code changes. > diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi > index 8670807cbdf..ffd7ad7f51d 100644 > --- a/doc/lispref/modes.texi > +++ b/doc/lispref/modes.texi > @@ -981,9 +981,7 @@ Basic Major Modes > @deffn Command text-mode > Text mode is a major mode for editing human languages. It defines the > @samp{"} and @samp{\} characters as having punctuation syntax > -(@pxref{Syntax Class Table}), and binds @kbd{M-@key{TAB}} to > -@code{ispell-complete-word} (@pxref{Spelling,,, emacs, The GNU Emacs > -Manual}). > +(@pxref{Syntax Class Table}). Why remove the reference to the command binding here? > +(defcustom text-mode-meta-tab-ispell-complete-word nil > + "Whether M-TAB invokes `ispell-complete-word' in Text mode. > + > +This user option only takes effect when you customize it in > +Custom or with `setopt', not with `setq'." > + :group 'text > + :type 'boolean > + :set (lambda (sym val) > + (if (set sym val) > + (keymap-set text-mode-map "C-M-i" #'ispell-complete-word) > + (keymap-unset text-mode-map "C-M-i" t)))) The :version tag is missing. Did you check what happens when Flyspell mode is turned on in a buffer under Text mode or one of its descendants? Thanks.