branch: externals/cape commit fe068552e5f85a8e2476ff32555a13fa643d7b71 Author: Daniel Mendler <m...@daniel-mendler.de> Commit: Daniel Mendler <m...@daniel-mendler.de>
cape-symbol: Add extra metadata functions on Emacs 28 --- cape.el | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/cape.el b/cape.el index 81286fa849..f3bd0da5de 100644 --- a/cape.el +++ b/cape.el @@ -284,10 +284,19 @@ If INTERACTIVE is nil the function acts like a Capf." ;;;;; cape-symbol (defvar cape--symbol-properties - (list :annotation-function #'cape--symbol-annotation - :exit-function #'cape--symbol-exit - :company-kind #'cape--symbol-kind - :exclusive 'no) + (append + (list :annotation-function #'cape--symbol-annotation + :exit-function #'cape--symbol-exit + :exclusive 'no) + (when (>= emacs-major-version 28) + (autoload 'elisp--company-kind "elisp-mode") + (autoload 'elisp--company-doc-buffer "elisp-mode") + (autoload 'elisp--company-doc-string "elisp-mode") + (autoload 'elisp--company-location "elisp-mode") + (list :company-kind 'elisp--company-kind + :company-doc-buffer 'elisp--company-doc-buffer + :company-docsig 'elisp--company-doc-string + :company-location 'elisp--company-location))) "Completion extra properties for `cape-symbol'.") (defun cape--symbol-exit (name status) @@ -301,17 +310,6 @@ STATUS is the exit status." (insert c)) (insert c))) -(defun cape--symbol-kind (sym) - "Return kind of SYM." - (setq sym (intern-soft sym)) - (cond - ((or (macrop sym) (special-form-p sym)) 'keyword) - ((fboundp sym) 'function) - ((boundp sym) 'variable) - ((featurep sym) 'module) - ((facep sym) 'color) - (t 'text))) - (defun cape--symbol-annotation (sym) "Return kind of SYM." (setq sym (intern-soft sym))