[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/company 8e4716172a 3/3: Merge pull request #1273 from y
From: |
ELPA Syncer |
Subject: |
[elpa] externals/company 8e4716172a 3/3: Merge pull request #1273 from yugaego/common-or-show |
Date: |
Fri, 7 Jan 2022 20:57:25 -0500 (EST) |
branch: externals/company
commit 8e4716172a2ba7fdd3f1d37096de88142ebbcc8d
Merge: 6eeaf46b86 109194f7b9
Author: Dmitry Gutov <dgutov@yandex.ru>
Commit: GitHub <noreply@github.com>
Merge pull request #1273 from yugaego/common-or-show
Add complete-common-or-show-delayed-tooltip
---
NEWS.md | 2 ++
company.el | 12 ++++++++++++
2 files changed, 14 insertions(+)
diff --git a/NEWS.md b/NEWS.md
index 3c98ac6a98..84abd06a15 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -2,6 +2,8 @@
## Next
+* New command `company-complete-common-or-show-delayed-tooltip`
+ ([#1214](https://github.com/company-mode/company-mode/discussions/1214)).
* Faces `company-scrollbar-fg` and `company-scrollbar-bg` have been renamed to
`company-tooltip-scrollbar-thumb` and `company-tooltip-scrollbar-track`
respectively.
diff --git a/company.el b/company.el
index 5a207dfe2c..a7ee3fa9da 100644
--- a/company.el
+++ b/company.el
@@ -2609,6 +2609,18 @@ With ARG, move by that many elements."
(current-prefix-arg arg))
(call-interactively 'company-select-next))))))
+(defun company-complete-common-or-show-delayed-tooltip ()
+ "Insert the common part of all candidates, or show a tooltip."
+ (interactive)
+ (when (company-manual-begin)
+ (let ((tick (buffer-chars-modified-tick)))
+ (call-interactively 'company-complete-common)
+ (when (eq tick (buffer-chars-modified-tick))
+ (let ((company-tooltip-idle-delay 0.0))
+ (company-complete)
+ (and company-candidates
+ (company-call-frontends 'post-command)))))))
+
(defun company-indent-or-complete-common (arg)
"Indent the current line or region, or complete the common part."
(interactive "P")