emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Word completion in text modes


From: Eli Zaretskii
Subject: Re: Word completion in text modes
Date: Sat, 25 Nov 2023 12:40:36 +0200

> From: Eshel Yaron <me@eshelyaron.com>
> Cc: emacs-devel@gnu.org
> Date: Tue, 21 Nov 2023 14:45:01 +0100
> 
> Eli Zaretskii <eliz@gnu.org> 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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]