all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Completion in org mode: why pcomplete?
@ 2021-12-21  4:11 Eric Abrahamsen
  2021-12-21  9:00 ` Eric S Fraga
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Abrahamsen @ 2021-12-21  4:11 UTC (permalink / raw)
  To: help-gnu-emacs

Hi all,

I got caught up for a while in exploring exciting completion frameworks
like ivy and selectrum, but eventually realized that my plain old M-TAB
in-buffer completion is broken, and has been for a long time.

prog-mode is fairly straightforward, but completion in text-mode
buffers -- in my present case, an org-mode buffer -- seems like a
confusing tangle, and I'm trying to unpick it.

Once I figured out how to stop flyspell mode from hijacking C-M-i, it
turned out that org-mode binds that to `complete-symbol' which consults
`completion-at-point-functions' of which
`pcomplete-completions-at-point' is one.

So actually org-mode completion is done with pcomplete, which is a
package I don't really understand, but pcomplete in a sort of "capf
emulation mode".

What I'd like to know is if I can ditch pcomplete altogether, bind C-M-i
to `completion-at-point', and just put my completion functions in
`completion-at-point-functions' directly.

My personal preference would be to have capf set to a list of the
following:

- an org-specific completion function (which might not exist if org only
  caters to pcomplete)
- an ispell function that completes based on dictionaries
- a function that does what `dabbrev-expand' does (expands based on
  words already in the buffer/other places)

`dabbrev-expand' already has its own keybinding, of course, and it does
more than what plain old `completion-at-point' is capable of, but I'd
*also* like it in capf.

Perhaps none of these three functions (by which I mean
ispell/dabbrev/org functions specifically meant for use within capf)
even exist?

Perhaps the easiest thing would be to try to add the ispell/dabbrev
stuff to pcomplete, so I can have all my completion inside pcomplete
inside completion-at-point-functions inside... complete-symbol?

I'd really rather just call `completion-at-point' directly. Does anyone
have any advice on this?

Thanks,
Eric




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

* Re: Completion in org mode: why pcomplete?
  2021-12-21  4:11 Completion in org mode: why pcomplete? Eric Abrahamsen
@ 2021-12-21  9:00 ` Eric S Fraga
  2021-12-21 17:26   ` Eric Abrahamsen
  0 siblings, 1 reply; 3+ messages in thread
From: Eric S Fraga @ 2021-12-21  9:00 UTC (permalink / raw)
  To: help-gnu-emacs

On Monday, 20 Dec 2021 at 20:11, Eric Abrahamsen wrote:
> [...]
> What I'd like to know is if I can ditch pcomplete altogether, bind C-M-i
> to `completion-at-point', and just put my completion functions in
> `completion-at-point-functions' directly.

Hi Eric,

I look forward to seeing what you find.

In the meantime, you might wish to have a look at hippie-expand which
does something similar to what you want in terms of accessing a number
of sources for generating the completions.

-- 
Eric S Fraga with org 9.5.1 in Emacs 29.0.50 on Debian 11.1




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

* Re: Completion in org mode: why pcomplete?
  2021-12-21  9:00 ` Eric S Fraga
@ 2021-12-21 17:26   ` Eric Abrahamsen
  0 siblings, 0 replies; 3+ messages in thread
From: Eric Abrahamsen @ 2021-12-21 17:26 UTC (permalink / raw)
  To: help-gnu-emacs

Eric S Fraga <e.fraga@ucl.ac.uk> writes:

> On Monday, 20 Dec 2021 at 20:11, Eric Abrahamsen wrote:
>> [...]
>> What I'd like to know is if I can ditch pcomplete altogether, bind C-M-i
>> to `completion-at-point', and just put my completion functions in
>> `completion-at-point-functions' directly.
>
> Hi Eric,
>
> I look forward to seeing what you find.

I switched the key-binding of C-M-i to call `completion-at-point'
directly, and the Org-specific completion still worked just fine, so
that's something!

I notice that `ispell-complete-word' has a FIXME about
`completion-at-point-functions', so I assume it doesn't currently work
with capf. But it's nice to know that someone (Stefan Monnier,
naturally) wishes it would (or he did back in 2012, when he added that
comment).

> In the meantime, you might wish to have a look at hippie-expand which
> does something similar to what you want in terms of accessing a number
> of sources for generating the completions.

I do know about hippie expand, but it seems like a repeat of the same
problem: another mini-framework that can draw completions from multiple
sources. It feels like capf is going to be that framework in the future,
so I'd like to try hard to stick to that, if possible.

Eric




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

end of thread, other threads:[~2021-12-21 17:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-21  4:11 Completion in org mode: why pcomplete? Eric Abrahamsen
2021-12-21  9:00 ` Eric S Fraga
2021-12-21 17:26   ` Eric Abrahamsen

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.