~pkal/clang-capf

A completion at point backend for clang
Update URL header
Bump version to 1.2.1
Update commentary section

clone

read-only
https://git.sr.ht/~pkal/clang-capf
read/write
git@git.sr.ht:~pkal/clang-capf

You can also use your local clone with git send-email.

#clang-capf.el (formerly cpp-capf.el)

This package provides a completion-at-point function to complete C/C++ code using clang, offering context-base suggestions for functions, variables and types without having to save the buffer.

While clang-capf doesn't require anything to be installed besides clang as an external component, a better looking completion front-end in Emacs, such as ivy might be worth recommending.

#How to use

Using MELPA and setup, a minimal but sufficient setup might look something like this:

(setup (:package clang-capf)
  (:with-mode cc-mode
    (:local-hook completion-at-point-functions #'clang-capf)))

This will let completion-at-point know that it should try clang-capf first when looking for completions, in c-mode buffers.

Also make sure that completion-at-point or complete-symbol is actually bound.

#Example

In vanilla Emacs:

screenshot1

With ivy:

screenshot2

#Bugs

  • After completing, no further text is added, although it might be useful to add () for functions or {} for structures.

Any further bugs or questions can be submitted to my public inbox.

#Copying

clang-capf.el is distributed under the CC0 1.0 Universal (CC0 1.0) Public Domain Dedication license.