From 59a1f58695d09ab29ddf992b2c0711c94a4039ea Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Tue, 3 Jan 2023 23:03:03 -0600 Subject: Switch to use-package --- lisp/+cape.el | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 lisp/+cape.el (limited to 'lisp/+cape.el') diff --git a/lisp/+cape.el b/lisp/+cape.el new file mode 100644 index 0000000..37e88fe --- /dev/null +++ b/lisp/+cape.el @@ -0,0 +1,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 -- cgit 1.4.1-21-gabe81