unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#70321: Can not turn completion-at-point on a per-mode basis on modes derived from text-mode
@ 2024-04-10  7:08 Pedro Andres Aranda Gutierrez
  2024-04-10 13:41 ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Pedro Andres Aranda Gutierrez @ 2024-04-10  7:08 UTC (permalink / raw)
  To: 70321

[-- Attachment #1: Type: text/plain, Size: 1086 bytes --]

Place the following file as init.el in a directory (e.g. ~/.demacs.d)

---cut here---
(setq inhibit-startup-screen t)

(defun auto-complete-text-off ()
  (message "Trying to turn off ispell completion...")
  (setopt text-mode-ispell-word-completion nil))

(add-hook 'org-mode-hook #'auto-complete-text-off)
(add-hook 'org-mode-hook #'(lambda()
                             (ispell-change-dictionary "en_GB")
                             (flyspell-mode t)))
---cut here---

Open a text file and C-h C-v completion-at-point-functions. You should see
ispell-completion-at-point in the list of completion functions

Open a .org file and C-h C-v completion-at-point-functions. You see
ispell-completion-at-point in the list of completion functions, when the
expected behaviour
is that ispell-completion-at-point is *not* in the list.

/PA
-- 
Fragen sind nicht da, um beantwortet zu werden,
Fragen sind da um gestellt zu werden
Georg Kreisler

Headaches with a Juju log:
unit-basic-16: 09:17:36 WARNING juju.worker.uniter.operation we should run
a leader-deposed hook here, but we can't yet

[-- Attachment #2: Type: text/html, Size: 1656 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#70321: Can not turn completion-at-point on a per-mode basis on modes derived from text-mode
  2024-04-10  7:08 bug#70321: Can not turn completion-at-point on a per-mode basis on modes derived from text-mode Pedro Andres Aranda Gutierrez
@ 2024-04-10 13:41 ` Eli Zaretskii
  2024-04-10 14:47   ` Pedro Andres Aranda Gutierrez
  2024-04-11  5:52   ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 2 replies; 6+ messages in thread
From: Eli Zaretskii @ 2024-04-10 13:41 UTC (permalink / raw)
  To: Pedro Andres Aranda Gutierrez, Eshel Yaron; +Cc: 70321

> From: Pedro Andres Aranda Gutierrez <paaguti@gmail.com>
> Date: Wed, 10 Apr 2024 09:08:08 +0200
> 
> Place the following file as init.el in a directory (e.g. ~/.demacs.d)
> 
> ---cut here---
> (setq inhibit-startup-screen t)
> 
> (defun auto-complete-text-off ()
>   (message "Trying to turn off ispell completion...")
>   (setopt text-mode-ispell-word-completion nil))
> 
> (add-hook 'org-mode-hook #'auto-complete-text-off)
> (add-hook 'org-mode-hook #'(lambda()
>                              (ispell-change-dictionary "en_GB")
>                              (flyspell-mode t)))
> ---cut here---
> 
> Open a text file and C-h C-v completion-at-point-functions. You should see 
> ispell-completion-at-point in the list of completion functions
> 
> Open a .org file and C-h C-v completion-at-point-functions. You see 
> ispell-completion-at-point in the list of completion functions, when the expected behaviour
> is that ispell-completion-at-point is *not* in the list. 

You cannot set this option in a mode hook, that's not how it is
supposed to be used.  If you customize the option to nil, any buffer
under Text mode or its derivative created afterwards will have the
completion turned off, that's the intended use of the option.

If you want to disable the completion selectively in a mode hook of
some descendant of Text mode, you need to remove
ispell-completion-at-point from the appropriate hook explicitly:

  (defun auto-complete-text-off ()
    (message "Trying to turn off ispell completion...")
    (remove-hook 'completion-at-point-functions #'ispell-completion-at-point t))

I see no bug here, just a misunderstanding.

Eshel, am I missing something here?





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#70321: Can not turn completion-at-point on a per-mode basis on modes derived from text-mode
  2024-04-10 13:41 ` Eli Zaretskii
@ 2024-04-10 14:47   ` Pedro Andres Aranda Gutierrez
  2024-04-11  5:52   ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 0 replies; 6+ messages in thread
From: Pedro Andres Aranda Gutierrez @ 2024-04-10 14:47 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 70321, Eshel Yaron

[-- Attachment #1: Type: text/plain, Size: 2169 bytes --]

Wonderful... those three lines are helpful. Could they make it to Emacs
base or to the manual?

On Wed, 10 Apr 2024 at 15:41, Eli Zaretskii <eliz@gnu.org> wrote:

> > From: Pedro Andres Aranda Gutierrez <paaguti@gmail.com>
> > Date: Wed, 10 Apr 2024 09:08:08 +0200
> >
> > Place the following file as init.el in a directory (e.g. ~/.demacs.d)
> >
> > ---cut here---
> > (setq inhibit-startup-screen t)
> >
> > (defun auto-complete-text-off ()
> >   (message "Trying to turn off ispell completion...")
> >   (setopt text-mode-ispell-word-completion nil))
> >
> > (add-hook 'org-mode-hook #'auto-complete-text-off)
> > (add-hook 'org-mode-hook #'(lambda()
> >                              (ispell-change-dictionary "en_GB")
> >                              (flyspell-mode t)))
> > ---cut here---
> >
> > Open a text file and C-h C-v completion-at-point-functions. You should
> see
> > ispell-completion-at-point in the list of completion functions
> >
> > Open a .org file and C-h C-v completion-at-point-functions. You see
> > ispell-completion-at-point in the list of completion functions, when the
> expected behaviour
> > is that ispell-completion-at-point is *not* in the list.
>
> You cannot set this option in a mode hook, that's not how it is
> supposed to be used.  If you customize the option to nil, any buffer
> under Text mode or its derivative created afterwards will have the
> completion turned off, that's the intended use of the option.
>
> If you want to disable the completion selectively in a mode hook of
> some descendant of Text mode, you need to remove
> ispell-completion-at-point from the appropriate hook explicitly:
>
>   (defun auto-complete-text-off ()
>     (message "Trying to turn off ispell completion...")
>     (remove-hook 'completion-at-point-functions
> #'ispell-completion-at-point t))
>
> I see no bug here, just a misunderstanding.
>
> Eshel, am I missing something here?
>


-- 
Fragen sind nicht da, um beantwortet zu werden,
Fragen sind da um gestellt zu werden
Georg Kreisler

Headaches with a Juju log:
unit-basic-16: 09:17:36 WARNING juju.worker.uniter.operation we should run
a leader-deposed hook here, but we can't yet

[-- Attachment #2: Type: text/html, Size: 3052 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#70321: Can not turn completion-at-point on a per-mode basis on modes derived from text-mode
  2024-04-10 13:41 ` Eli Zaretskii
  2024-04-10 14:47   ` Pedro Andres Aranda Gutierrez
@ 2024-04-11  5:52   ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-04-11  7:59     ` Pedro Andres Aranda Gutierrez
  1 sibling, 1 reply; 6+ messages in thread
From: Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-04-11  5:52 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 70321, Pedro Andres Aranda Gutierrez

Hi Eli, Pedro,

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Pedro Andres Aranda Gutierrez <paaguti@gmail.com>
>> Date: Wed, 10 Apr 2024 09:08:08 +0200
>>
>> Place the following file as init.el in a directory (e.g. ~/.demacs.d)
>>
>> ---cut here---
>> (setq inhibit-startup-screen t)
>>
>> (defun auto-complete-text-off ()
>>   (message "Trying to turn off ispell completion...")
>>   (setopt text-mode-ispell-word-completion nil))
>>
>> (add-hook 'org-mode-hook #'auto-complete-text-off)
>> (add-hook 'org-mode-hook #'(lambda()
>>                              (ispell-change-dictionary "en_GB")
>>                              (flyspell-mode t)))
>> ---cut here---
>>
>> Open a text file and C-h C-v completion-at-point-functions. You should see
>> ispell-completion-at-point in the list of completion functions
>>
>> Open a .org file and C-h C-v completion-at-point-functions. You see
>> ispell-completion-at-point in the list of completion functions, when the expected behaviour
>> is that ispell-completion-at-point is *not* in the list.
>
> You cannot set this option in a mode hook, that's not how it is
> supposed to be used.  If you customize the option to nil, any buffer
> under Text mode or its derivative created afterwards will have the
> completion turned off, that's the intended use of the option.
>
> If you want to disable the completion selectively in a mode hook of
> some descendant of Text mode, you need to remove
> ispell-completion-at-point from the appropriate hook explicitly:
>
>   (defun auto-complete-text-off ()
>     (message "Trying to turn off ispell completion...")
>     (remove-hook 'completion-at-point-functions #'ispell-completion-at-point t))
>
> I see no bug here, just a misunderstanding.
>
> Eshel, am I missing something here?

I don't think you're missing anything here.  ispell-completion-at-point
is just a function that can either be in completion-at-point-functions
or not.  The option text-mode-ispell-word-completion controls whether
text-mode adds ispell-completion-at-point to c-a-p-f initially, but
users can also always rely on add/remove-hook to manage it directly.


Best,

Eshel





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#70321: Can not turn completion-at-point on a per-mode basis on modes derived from text-mode
  2024-04-11  5:52   ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-04-11  7:59     ` Pedro Andres Aranda Gutierrez
  2024-04-12  7:36       ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 6+ messages in thread
From: Pedro Andres Aranda Gutierrez @ 2024-04-11  7:59 UTC (permalink / raw)
  To: Eshel Yaron; +Cc: Eli Zaretskii, 70321

[-- Attachment #1: Type: text/plain, Size: 3422 bytes --]

Hi Eshel

thanks for confirming my understanding. So now, my only "request" would be
to add Elisp code
to make it easier to manage the c-a-p-f.

My main concern is that they are people out there to whom the additional
information provided
by ispell-completion-at-point is a burden more than a help.

Attention/concentration deficit is something we should really take
seriously. Not only in this case,
but overall. I have taught emacs to some people and, just as an example,
company, which I use
in all my programming modes in conjunction with eglot (a neat package,
right?) was felt as disturbing
by some people, because they felt over-stimulated by all the options it
gave to them.

Therefore I'm "making  noise" now. Sorry I could not be part of the
discussion back in January, but priorities
in life didn't include Emacs back then.

BR,/PA

On Thu, 11 Apr 2024 at 07:52, Eshel Yaron <me@eshelyaron.com> wrote:

> Hi Eli, Pedro,
>
> Eli Zaretskii <eliz@gnu.org> writes:
>
> >> From: Pedro Andres Aranda Gutierrez <paaguti@gmail.com>
> >> Date: Wed, 10 Apr 2024 09:08:08 +0200
> >>
> >> Place the following file as init.el in a directory (e.g. ~/.demacs.d)
> >>
> >> ---cut here---
> >> (setq inhibit-startup-screen t)
> >>
> >> (defun auto-complete-text-off ()
> >>   (message "Trying to turn off ispell completion...")
> >>   (setopt text-mode-ispell-word-completion nil))
> >>
> >> (add-hook 'org-mode-hook #'auto-complete-text-off)
> >> (add-hook 'org-mode-hook #'(lambda()
> >>                              (ispell-change-dictionary "en_GB")
> >>                              (flyspell-mode t)))
> >> ---cut here---
> >>
> >> Open a text file and C-h C-v completion-at-point-functions. You should
> see
> >> ispell-completion-at-point in the list of completion functions
> >>
> >> Open a .org file and C-h C-v completion-at-point-functions. You see
> >> ispell-completion-at-point in the list of completion functions, when
> the expected behaviour
> >> is that ispell-completion-at-point is *not* in the list.
> >
> > You cannot set this option in a mode hook, that's not how it is
> > supposed to be used.  If you customize the option to nil, any buffer
> > under Text mode or its derivative created afterwards will have the
> > completion turned off, that's the intended use of the option.
> >
> > If you want to disable the completion selectively in a mode hook of
> > some descendant of Text mode, you need to remove
> > ispell-completion-at-point from the appropriate hook explicitly:
> >
> >   (defun auto-complete-text-off ()
> >     (message "Trying to turn off ispell completion...")
> >     (remove-hook 'completion-at-point-functions
> #'ispell-completion-at-point t))
> >
> > I see no bug here, just a misunderstanding.
> >
> > Eshel, am I missing something here?
>
> I don't think you're missing anything here.  ispell-completion-at-point
> is just a function that can either be in completion-at-point-functions
> or not.  The option text-mode-ispell-word-completion controls whether
> text-mode adds ispell-completion-at-point to c-a-p-f initially, but
> users can also always rely on add/remove-hook to manage it directly.
>
>
> Best,
>
> Eshel
>


-- 
Fragen sind nicht da, um beantwortet zu werden,
Fragen sind da um gestellt zu werden
Georg Kreisler

Headaches with a Juju log:
unit-basic-16: 09:17:36 WARNING juju.worker.uniter.operation we should run
a leader-deposed hook here, but we can't yet

[-- Attachment #2: Type: text/html, Size: 4755 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#70321: Can not turn completion-at-point on a per-mode basis on modes derived from text-mode
  2024-04-11  7:59     ` Pedro Andres Aranda Gutierrez
@ 2024-04-12  7:36       ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 6+ messages in thread
From: Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-04-12  7:36 UTC (permalink / raw)
  To: Pedro Andres Aranda Gutierrez; +Cc: Eli Zaretskii, 70321

Pedro Andres Aranda Gutierrez <paaguti@gmail.com> writes:

> Hi Eshel
>
> thanks for confirming my understanding. So now, my only "request" would be to add Elisp code
> to make it easier to manage the c-a-p-f.
>
> My main concern is that they are people out there to whom the additional information provided
> by ispell-completion-at-point is a burden more than a help.

By default Emacs doesn't show this information unless and until you ask
for it, by invoking 'completion-at-point'.  Moreover we use a low
priority for 'ispell-completion-at-point' so it only kicks in if no
other 'completion-at-point' function (backend) is available.  So in
principle I wouldn't think this should burden anyone.

If you've configured Emacs to automatically show 'completion-at-point'
results via one package or another, and you want to exclude the results
of 'ispell-completion-at-point' from that auto-completion, either
configure your auto-completion set up to skip this function or use
'text-mode-ispell-word-completion' to avoid adding this function to
'completion-at-point-functions' in the first place.  If you then want to
add 'ispell-completion-at-point' to c-a-p-f in some other mode, perhaps
a text-mode derivative, use 'add-hook' as usual.  Does that make sense?


Best,

Eshel





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-04-12  7:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-10  7:08 bug#70321: Can not turn completion-at-point on a per-mode basis on modes derived from text-mode Pedro Andres Aranda Gutierrez
2024-04-10 13:41 ` Eli Zaretskii
2024-04-10 14:47   ` Pedro Andres Aranda Gutierrez
2024-04-11  5:52   ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-11  7:59     ` Pedro Andres Aranda Gutierrez
2024-04-12  7:36       ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).