all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Eshel Yaron <me@eshelyaron.com>
Cc: emacs-devel@gnu.org
Subject: Re: Word completion in text modes
Date: Sat, 25 Nov 2023 12:40:36 +0200	[thread overview]
Message-ID: <83leamcdzv.fsf@gnu.org> (raw)
In-Reply-To: <m1cyw3i5k2.fsf@sp-byods-145-109-28-198.wireless.uva.nl> (message from Eshel Yaron on Tue, 21 Nov 2023 14:45:01 +0100)

> 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	other threads:[~2023-11-25 10:40 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-18 12:03 Word completion in text modes Eshel Yaron
2023-11-18 12:39 ` Eli Zaretskii
2023-11-18 13:21   ` Eshel Yaron
2023-11-18 13:50     ` Eli Zaretskii
2023-11-18 15:53       ` Eshel Yaron
2023-11-18 16:03         ` [External] : " Drew Adams
2023-11-18 16:37         ` Eli Zaretskii
2023-11-18 19:03           ` Eshel Yaron
2023-11-18 19:18             ` Eli Zaretskii
2023-11-21 13:45               ` Eshel Yaron
2023-11-25 10:40                 ` Eli Zaretskii [this message]
2023-11-25 12:11                   ` Eshel Yaron
2023-11-25 12:33                     ` Eli Zaretskii
2023-11-25 13:00                       ` Eshel Yaron
2023-11-26 10:31                         ` Eli Zaretskii
2023-11-26 11:03                           ` Eshel Yaron
2023-11-26 11:23                             ` Eli Zaretskii
2023-11-18 16:05   ` [External] : " Drew Adams
2023-11-18 16:55     ` Juergen Fenn
2023-11-18 18:33 ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83leamcdzv.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=me@eshelyaron.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.