[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 24c92b3: Provide information to show icons with Elisp completions
From: |
Dmitry Gutov |
Subject: |
master 24c92b3: Provide information to show icons with Elisp completions |
Date: |
Mon, 29 Mar 2021 20:42:56 -0400 (EDT) |
branch: master
commit 24c92b35b5ed8432e53a27ed3cb477788894ecdc
Author: Dmitry Gutov <dgutov@yandex.ru>
Commit: Dmitry Gutov <dgutov@yandex.ru>
Provide information to show icons with Elisp completions
* lisp/progmodes/elisp-mode.el (elisp--company-kind): New function.
(elisp-completion-at-point): Use it. And a couple of anonymous
:company-kind functions too.
---
lisp/progmodes/elisp-mode.el | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index cdf6085..8ade718 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -530,6 +530,7 @@ functions are annotated with \"<f>\" via the
((elisp--expect-function-p beg)
(list nil obarray
:predicate #'fboundp
+ :company-kind #'elisp--company-kind
:company-doc-buffer #'elisp--company-doc-buffer
:company-docsig #'elisp--company-doc-string
:company-location #'elisp--company-location))
@@ -543,6 +544,7 @@ functions are annotated with \"<f>\" via the
(symbol-plist sym)))
:annotation-function
(lambda (str) (if (fboundp (intern-soft str)) "
<f>"))
+ :company-kind #'elisp--company-kind
:company-doc-buffer #'elisp--company-doc-buffer
:company-docsig #'elisp--company-doc-string
:company-location #'elisp--company-location))
@@ -553,6 +555,11 @@ functions are annotated with \"<f>\" via the
obarray
#'boundp
'strict))
+ :company-kind
+ (lambda (s)
+ (if (test-completion s
elisp--local-variables-completion-table)
+ 'value
+ 'variable))
:company-doc-buffer #'elisp--company-doc-buffer
:company-docsig #'elisp--company-doc-string
:company-location #'elisp--company-location)))
@@ -599,11 +606,13 @@ functions are annotated with \"<f>\" via the
(looking-at "\\_<let\\*?\\_>"))))
(list t obarray
:predicate #'boundp
+ :company-kind (lambda (_) 'variable)
:company-doc-buffer #'elisp--company-doc-buffer
:company-docsig #'elisp--company-doc-string
:company-location #'elisp--company-location))
(_ (list nil obarray
:predicate #'fboundp
+ :company-kind #'elisp--company-kind
:company-doc-buffer #'elisp--company-doc-buffer
:company-docsig #'elisp--company-doc-string
:company-location #'elisp--company-location
@@ -619,6 +628,16 @@ functions are annotated with \"<f>\" via the
" " (cadr table-etc)))
(cddr table-etc)))))))))
+(defun elisp--company-kind (str)
+ (let ((sym (intern-soft str)))
+ (cond
+ ((or (macrop sym) (special-form-p sym)) 'keyword)
+ ((fboundp sym) 'function)
+ ((boundp sym) 'variable)
+ ((featurep sym) 'module)
+ ((facep sym) 'color)
+ (t 'text))))
+
(defun lisp-completion-at-point (&optional _predicate)
(declare (obsolete elisp-completion-at-point "25.1"))
(elisp-completion-at-point))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 24c92b3: Provide information to show icons with Elisp completions,
Dmitry Gutov <=