diff options
| author | Daniel Mendler <mail@daniel-mendler.de> | 2022-11-20 04:41:03 +0100 |
|---|---|---|
| committer | Daniel Mendler <mail@daniel-mendler.de> | 2022-11-20 04:41:03 +0100 |
| commit | fe068552e5f85a8e2476ff32555a13fa643d7b71 (patch) | |
| tree | e704d97cde2a03a68f76ba8d068c239dc42cf3b1 | |
| parent | 4b32036a6c667b445dcc001fd70a01eee8baa924 (diff) | |
cape-symbol: Add extra metadata functions on Emacs 28
| -rw-r--r-- | cape.el | 28 |
1 files changed, 13 insertions, 15 deletions
@@ -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)) |
