unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Eric Abrahamsen <eric@ericabrahamsen.net>
To: help-gnu-emacs@gnu.org
Subject: Completion in org mode: why pcomplete?
Date: Mon, 20 Dec 2021 20:11:30 -0800	[thread overview]
Message-ID: <878rwe7g25.fsf@ericabrahamsen.net> (raw)

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




             reply	other threads:[~2021-12-21  4:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-21  4:11 Eric Abrahamsen [this message]
2021-12-21  9:00 ` Completion in org mode: why pcomplete? Eric S Fraga
2021-12-21 17:26   ` Eric Abrahamsen

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=878rwe7g25.fsf@ericabrahamsen.net \
    --to=eric@ericabrahamsen.net \
    --cc=help-gnu-emacs@gnu.org \
    /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.
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).