]> git.eshelyaron.com Git - emacs.git/commitdiff
Support :company-deprecated completion property
authorDmitry Gutov <dgutov@yandex.ru>
Sat, 23 Oct 2021 13:28:53 +0000 (16:28 +0300)
committerDmitry Gutov <dgutov@yandex.ru>
Sat, 23 Oct 2021 13:29:30 +0000 (16:29 +0300)
* lisp/progmodes/elisp-mode.el (elisp--company-deprecated):
New function.
(elisp-completion-at-point): Use it.

lisp/progmodes/elisp-mode.el

index 9522055670da70b7795e73eca0d624aa887637c0..7da93a351a2921428db200f117902b0a2c2a3fce 100644 (file)
@@ -636,7 +636,8 @@ functions are annotated with \"<f>\" via the
                            :company-kind #'elisp--company-kind
                            :company-doc-buffer #'elisp--company-doc-buffer
                            :company-docsig #'elisp--company-doc-string
-                           :company-location #'elisp--company-location))
+                           :company-location #'elisp--company-location
+                           :company-deprecated #'elisp--company-deprecated))
                     (quoted
                      (list nil (elisp--completion-local-symbols)
                            ;; Don't include all symbols (bug#16646).
@@ -652,7 +653,8 @@ functions are annotated with \"<f>\" via the
                            :company-kind #'elisp--company-kind
                            :company-doc-buffer #'elisp--company-doc-buffer
                            :company-docsig #'elisp--company-doc-string
-                           :company-location #'elisp--company-location))
+                           :company-location #'elisp--company-location
+                           :company-deprecated #'elisp--company-deprecated))
                     (t
                      (list nil (completion-table-merge
                                 elisp--local-variables-completion-table
@@ -667,7 +669,8 @@ functions are annotated with \"<f>\" via the
                                'variable))
                            :company-doc-buffer #'elisp--company-doc-buffer
                            :company-docsig #'elisp--company-doc-string
-                           :company-location #'elisp--company-location)))
+                           :company-location #'elisp--company-location
+                           :company-deprecated #'elisp--company-deprecated)))
                  ;; Looks like a funcall position.  Let's double check.
                  (save-excursion
                    (goto-char (1- beg))
@@ -714,13 +717,15 @@ functions are annotated with \"<f>\" via the
                               :company-kind (lambda (_) 'variable)
                               :company-doc-buffer #'elisp--company-doc-buffer
                               :company-docsig #'elisp--company-doc-string
-                              :company-location #'elisp--company-location))
+                              :company-location #'elisp--company-location
+                              :company-deprecated #'elisp--company-deprecated))
                        (_ (list nil (elisp--completion-local-symbols)
                                 :predicate #'elisp--shorthand-aware-fboundp
                                 :company-kind #'elisp--company-kind
                                 :company-doc-buffer #'elisp--company-doc-buffer
                                 :company-docsig #'elisp--company-doc-string
                                 :company-location #'elisp--company-location
+                                :company-deprecated #'elisp--company-deprecated
                                 ))))))))
           (nconc (list beg end)
                  (if (null (car table-etc))
@@ -743,6 +748,11 @@ functions are annotated with \"<f>\" via the
      ((facep sym) 'color)
      (t 'text))))
 
+(defun elisp--company-deprecated (str)
+  (let ((sym (intern-soft str)))
+    (or (get sym 'byte-obsolete-variable)
+        (get sym 'byte-obsolete-info))))
+
 (defun lisp-completion-at-point (&optional _predicate)
   (declare (obsolete elisp-completion-at-point "25.1"))
   (elisp-completion-at-point))