all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Position of functions in `completion-at-point-functions'
@ 2024-02-16  8:42 Arash Esbati
  2024-02-19 16:10 ` Eshel Yaron
  0 siblings, 1 reply; 5+ messages in thread
From: Arash Esbati @ 2024-02-16  8:42 UTC (permalink / raw)
  To: emacs-devel

Hi all,

Emacs 30.0.50 has this in text-mode.el (line 155; line break added for
better legibility):

  (when (eq text-mode-ispell-word-completion 'completion-at-point)
    (add-hook 'completion-at-point-functions
              #'ispell-completion-at-point 10 t))

With the latest AUCTeX, the new LaTeX-mode now derives from text-mode
and the value of `completion-at-point-functions' becomes this in a .tex
file:

  (TeX--completion-at-point t ispell-completion-at-point
                            LaTeX--arguments-completion-at-point)

The problem is that `ispell-completion-at-point' kicks in also when
point is inside a macro argument and one actually expects key=val
completion for instance, so I want
`LaTeX--arguments-completion-at-point' before
`ispell-completion-at-point' in that list.  AUCTeX requires Emacs 27
now, and I can fix this by changing this addition in latex.el from:

  (add-hook 'completion-at-point-functions
            #'LaTeX--arguments-completion-at-point t t)

to something like:

  (add-hook 'completion-at-point-functions
            #'LaTeX--arguments-completion-at-point 5 t)

Before making this change to 5 (which is an arbitrary choice): Is there
any kind of range convention where major/minor modes should put their
completion functions?  Any pointer is appreciated.

Best, Arash



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

* Re: Position of functions in `completion-at-point-functions'
  2024-02-16  8:42 Position of functions in `completion-at-point-functions' Arash Esbati
@ 2024-02-19 16:10 ` Eshel Yaron
  2024-02-20  7:35   ` Juri Linkov
  2024-02-20 11:52   ` Arash Esbati
  0 siblings, 2 replies; 5+ messages in thread
From: Eshel Yaron @ 2024-02-19 16:10 UTC (permalink / raw)
  To: Arash Esbati; +Cc: emacs-devel

Hello Arash,

Arash Esbati <arash@gnu.org> writes:

> Hi all,
>
> Emacs 30.0.50 has this in text-mode.el (line 155; line break added for
> better legibility):
>
>   (when (eq text-mode-ispell-word-completion 'completion-at-point)
>     (add-hook 'completion-at-point-functions
>               #'ispell-completion-at-point 10 t))
>
> With the latest AUCTeX, the new LaTeX-mode now derives from text-mode
> and the value of `completion-at-point-functions' becomes this in a .tex
> file:
>
>   (TeX--completion-at-point t ispell-completion-at-point
>                             LaTeX--arguments-completion-at-point)
>
> The problem is that `ispell-completion-at-point' kicks in also when
> point is inside a macro argument and one actually expects key=val
> completion for instance, so I want
> `LaTeX--arguments-completion-at-point' before
> `ispell-completion-at-point' in that list.  AUCTeX requires Emacs 27
> now, and I can fix this by changing this addition in latex.el from:
>
>   (add-hook 'completion-at-point-functions
>             #'LaTeX--arguments-completion-at-point t t)
>
> to something like:
>
>   (add-hook 'completion-at-point-functions
>             #'LaTeX--arguments-completion-at-point 5 t)
>
> Before making this change to 5 (which is an arbitrary choice): Is there
> any kind of range convention where major/minor modes should put their
> completion functions?  Any pointer is appreciated.

This isn't an authoritative answer, but I'm not aware of such a
convention.  IIRC I picked a DEPTH of 10 for that add-hook call mostly
because that's what text-mode, and prog-mode, were already using for
their context-menu-functions.  I think a value of 5 should be fine for
LaTeX--arguments-completion-at-point (and 9 too, for that matter).


Best,

Eshel



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

* Re: Position of functions in `completion-at-point-functions'
  2024-02-19 16:10 ` Eshel Yaron
@ 2024-02-20  7:35   ` Juri Linkov
  2024-02-20 11:38     ` Arash Esbati
  2024-02-20 11:52   ` Arash Esbati
  1 sibling, 1 reply; 5+ messages in thread
From: Juri Linkov @ 2024-02-20  7:35 UTC (permalink / raw)
  To: Eshel Yaron; +Cc: Arash Esbati, emacs-devel

>>   (add-hook 'completion-at-point-functions
>>             #'LaTeX--arguments-completion-at-point t t)
>>
>> to something like:
>>
>>   (add-hook 'completion-at-point-functions
>>             #'LaTeX--arguments-completion-at-point 5 t)
>>
>> Before making this change to 5 (which is an arbitrary choice): Is there
>> any kind of range convention where major/minor modes should put their
>> completion functions?  Any pointer is appreciated.
>
> This isn't an authoritative answer, but I'm not aware of such a
> convention.  IIRC I picked a DEPTH of 10 for that add-hook call mostly
> because that's what text-mode, and prog-mode, were already using for
> their context-menu-functions.  I think a value of 5 should be fine for
> LaTeX--arguments-completion-at-point (and 9 too, for that matter).

The step 5 between numbers 5, 10, 15, ... or 10 for 10, 20, 30, ...
is like in BASIC that allows you inserting new elements in between
without renumbering the entire sequence.



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

* Re: Position of functions in `completion-at-point-functions'
  2024-02-20  7:35   ` Juri Linkov
@ 2024-02-20 11:38     ` Arash Esbati
  0 siblings, 0 replies; 5+ messages in thread
From: Arash Esbati @ 2024-02-20 11:38 UTC (permalink / raw)
  To: Juri Linkov; +Cc: Eshel Yaron, emacs-devel

Juri Linkov <juri@linkov.net> writes:

> The step 5 between numbers 5, 10, 15, ... or 10 for 10, 20, 30, ...
> is like in BASIC that allows you inserting new elements in between
> without renumbering the entire sequence.

Yes, this was exactly my reasoning for 5, which I eventually used.

Best, Arash



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

* Re: Position of functions in `completion-at-point-functions'
  2024-02-19 16:10 ` Eshel Yaron
  2024-02-20  7:35   ` Juri Linkov
@ 2024-02-20 11:52   ` Arash Esbati
  1 sibling, 0 replies; 5+ messages in thread
From: Arash Esbati @ 2024-02-20 11:52 UTC (permalink / raw)
  To: Eshel Yaron; +Cc: emacs-devel

Hi Eshel,

Eshel Yaron <me@eshelyaron.com> writes:

> This isn't an authoritative answer, but I'm not aware of such a
> convention.

Thanks for your response.

> IIRC I picked a DEPTH of 10 for that add-hook call mostly because
> that's what text-mode, and prog-mode, were already using for their
> context-menu-functions.

Ah, Ok, now I see, thanks for the clarification.

> I think a value of 5 should be fine for
> LaTeX--arguments-completion-at-point (and 9 too, for that matter).

At the end of the day, I took 5 and installed it.

Best, Arash



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

end of thread, other threads:[~2024-02-20 11:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-16  8:42 Position of functions in `completion-at-point-functions' Arash Esbati
2024-02-19 16:10 ` Eshel Yaron
2024-02-20  7:35   ` Juri Linkov
2024-02-20 11:38     ` Arash Esbati
2024-02-20 11:52   ` Arash Esbati

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.