blob: 37e88feebdb542448ce8d2869f30c8afe6d3d18c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
;;; cape.el -*- lexical-binding: t; -*-
;;; Code:
(require 'cape)
(defmacro +cape-insinuate (hook capes &rest capfs)
"Insinuate CAPES for a mode.
Add a function to HOOK that will add CAPES to the local
`completion-at-point-functions' for that mode's buffer. If CAPFS
are given, mark them all as non-exclusive."
(let ((fn (intern (format "+cape-insinuate@%s" hook))))
`(prog1
,@(when capes
`((defun ,fn ()
,@(cl-loop for cape in capes
collect `(add-hook 'completion-at-point-functions
#',cape 90 :local)))
(add-hook ',hook #',fn)))
,@(cl-loop for capf in capfs
collect `(advice-add ',capf :around
#'cape-wrap-nonexclusive)))))
(provide '+cape)
;;; +cape.el ends here
|