diff options
| author | Daniel Mendler <mail@daniel-mendler.de> | 2022-03-28 20:39:37 +0200 |
|---|---|---|
| committer | Daniel Mendler <mail@daniel-mendler.de> | 2022-03-28 20:39:37 +0200 |
| commit | 27fb9e2da7fa1eb940d49ced6c834980214bb665 (patch) | |
| tree | 9de7767aadb989a02936f18882861ca94909edf3 /cape.el | |
| parent | ee826d70fdd2e8324a4af1a427ea9ce54f5e32e6 (diff) | |
Add cape-wrap-trigger-charstrigger-chars
Diffstat (limited to 'cape.el')
| -rw-r--r-- | cape.el | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -1067,6 +1067,19 @@ If DONT-FOLD is non-nil return a case sensitive table instead." `(,beg ,end ,(cape--noninterruptible-table table) ,@plist)))) ;;;###autoload +(defun cape-wrap-trigger-chars (capf chars) + "Call CAPF and enforce completion after trigger CHARS." + (pcase (funcall capf) + (`(,beg ,end ,table . ,plist) + (when (stringp chars) + (setq chars (string-to-list chars))) + (when (or (memq (char-before beg) chars) + (memq (char-after beg) chars)) + `(,beg ,end ,table + :company-prefix-length t + ,@plist))))) + +;;;###autoload (defun cape-wrap-prefix-length (capf length) "Call CAPF and ensure that prefix length is greater or equal than LENGTH. If the prefix is long enough, enforce auto completion." @@ -1116,6 +1129,8 @@ If the prefix is long enough, enforce auto completion." (cape--capf-wrapper purify) ;;;###autoload (autoload 'cape-capf-silent "cape") (cape--capf-wrapper silent) +;;;###autoload (autoload 'cape-capf-trigger-chars "cape") +(cape--capf-wrapper trigger-chars) (provide 'cape) ;;; cape.el ends here |
