;;; 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