branch: externals/company commit 9bc678a5c6627ea45853db38579fa67b2ad2863a Author: Dmitry Gutov <dgu...@yandex.ru> Commit: Dmitry Gutov <dgu...@yandex.ru>
Remove <f> elisp annotations when icons are used #1070 --- company-capf.el | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/company-capf.el b/company-capf.el index 496cd57..813b2aa 100644 --- a/company-capf.el +++ b/company-capf.el @@ -1,6 +1,6 @@ ;;; company-capf.el --- company-mode completion-at-point-functions backend -*- lexical-binding: t -*- -;; Copyright (C) 2013-2019 Free Software Foundation, Inc. +;; Copyright (C) 2013-2019, 2021 Free Software Foundation, Inc. ;; Author: Stefan Monnier <monn...@iro.umontreal.ca> @@ -148,9 +148,7 @@ so we can't just use the preceding variable instead.") :company-location))) (when f (funcall f arg)))) (`annotation - (let ((f (plist-get (nthcdr 4 company-capf--current-completion-data) - :annotation-function))) - (when f (funcall f arg)))) + (company-capf--annotation arg)) (`kind (let ((f (plist-get (nthcdr 4 company-capf--current-completion-data) :company-kind))) @@ -162,6 +160,17 @@ so we can't just use the preceding variable instead.") (company--capf-post-completion arg)) )) +(defun company-capf--annotation (arg) + (let* ((f (plist-get (nthcdr 4 company-capf--current-completion-data) + :annotation-function)) + (annotation (when f (funcall f arg)))) + (if (and company-format-margin-function + (equal annotation " <f>") ; elisp-completion-at-point, pre-icons + (plist-get (nthcdr 4 company-capf--current-completion-data) + :company-kind)) + nil + annotation))) + (defun company-capf--candidates (input) (let ((res (company--capf-data))) (company-capf--save-current-data res)