[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Word completion in text modes
|
From: |
Eshel Yaron |
|
Subject: |
Re: Word completion in text modes |
|
Date: |
Sat, 25 Nov 2023 13:11:27 +0100 |
|
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Eshel Yaron <me@eshelyaron.com>
>>
>> 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
>>
>> ...
> 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.
I see, done in the updated patch I'm attaching below.
>> 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?
Text mode no longer binds `C-M-i` to anything, relying on the global
binding instead. So there doesn't seem to be any reason to mention this
binding here anymore, just like it's not mentioned in the description of
`prog-mode` that follows this paragraph. Does that make sense?
>> +(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.
Thanks, I've added it in the updated patch.
> Did you check what happens when Flyspell mode is turned on in a buffer
> under Text mode or one of its descendants?
Yes. Unless one sets `flyspell-use-meta-tab` to nil, Flyspell mode binds
`C-M-i` to a completely different command, `flyspell-auto-correct-word`.
That is something that people are hopefully aware of when they opt-in to
enabling of this minor mode, I suppose. Personally, I don't really like that
behavior, so I unbind many of Flyspell's bindings. I'd be happy to see
`flyspell-use-meta-tab` set to nil be default, but since Flyspell is opt-in,
I consider it a bit of a different story compared to the Text mode binding.
Patch v2 follows:
v2-0001-Unbind-C-M-i-in-Text-mode.patch
Description: Text Data
- Re: Word completion in text modes, (continued)
- Re: Word completion in text modes, Eli Zaretskii, 2023/11/18
- Re: Word completion in text modes, Eshel Yaron, 2023/11/18
- Re: Word completion in text modes, Eli Zaretskii, 2023/11/18
- Re: Word completion in text modes, Eshel Yaron, 2023/11/18
- RE: [External] : Re: Word completion in text modes, Drew Adams, 2023/11/18
- Re: Word completion in text modes, Eli Zaretskii, 2023/11/18
- Re: Word completion in text modes, Eshel Yaron, 2023/11/18
- Re: Word completion in text modes, Eli Zaretskii, 2023/11/18
- Re: Word completion in text modes, Eshel Yaron, 2023/11/21
- Re: Word completion in text modes, Eli Zaretskii, 2023/11/25
- Re: Word completion in text modes,
Eshel Yaron <=
- Re: Word completion in text modes, Eli Zaretskii, 2023/11/25
- Re: Word completion in text modes, Eshel Yaron, 2023/11/25
- Re: Word completion in text modes, Eli Zaretskii, 2023/11/26
- Re: Word completion in text modes, Eshel Yaron, 2023/11/26
- Re: Word completion in text modes, Eli Zaretskii, 2023/11/26
RE: [External] : Re: Word completion in text modes, Drew Adams, 2023/11/18
Re: Word completion in text modes, Juri Linkov, 2023/11/18