update of packages
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
;;; company-capf.el --- company-mode completion-at-point-functions backend -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2013-2021 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 2013-2022 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
|
||||
|
||||
@@ -135,27 +135,10 @@ so we can't just use the preceding variable instead.")
|
||||
(`match
|
||||
;; Ask the for the `:company-match' function. If that doesn't help,
|
||||
;; fallback to sniffing for face changes to get a suitable value.
|
||||
(let ((f (plist-get (nthcdr 4 company-capf--current-completion-data)
|
||||
:company-match)))
|
||||
(if f (funcall f arg)
|
||||
(let* ((match-start nil) (pos -1)
|
||||
(prop-value nil) (faces nil)
|
||||
(has-face-p nil) chunks
|
||||
(limit (length arg)))
|
||||
(while (< pos limit)
|
||||
(setq pos
|
||||
(if (< pos 0) 0 (next-property-change pos arg limit)))
|
||||
(setq prop-value (or
|
||||
(get-text-property pos 'face arg)
|
||||
(get-text-property pos 'font-lock-face arg))
|
||||
faces (if (listp prop-value) prop-value (list prop-value))
|
||||
has-face-p (memq 'completions-common-part faces))
|
||||
(cond ((and (not match-start) has-face-p)
|
||||
(setq match-start pos))
|
||||
((and match-start (not has-face-p))
|
||||
(push (cons match-start pos) chunks)
|
||||
(setq match-start nil))))
|
||||
(nreverse chunks)))))
|
||||
(let ((f (or (plist-get (nthcdr 4 company-capf--current-completion-data)
|
||||
:company-match)
|
||||
#'company--match-from-capf-face)))
|
||||
(funcall f arg)))
|
||||
(`duplicates t)
|
||||
(`no-cache t) ;Not much can be done here, as long as we handle
|
||||
;non-prefix matches.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
;;; company-clang.el --- company-mode completion backend for Clang -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2009-2011, 2013-2021 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 2009-2011, 2013-2023 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Nikolaj Schumacher
|
||||
|
||||
@@ -119,10 +119,9 @@ or automatically through a custom `company-clang-prefix-guesser'."
|
||||
|
||||
;; parsing ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
;; TODO: Handle Pattern (syntactic hints would be neat).
|
||||
;; Do we ever see OVERLOAD (or OVERRIDE)?
|
||||
(defconst company-clang--completion-pattern
|
||||
"^COMPLETION: \\_<\\(%s[a-zA-Z0-9_:]*\\)\\(?:\\(?: (InBase)\\)? : \\(.*\\)$\\)?$")
|
||||
"^COMPLETION: \\_<\\(%s[a-zA-Z0-9_:]*\\|Pattern\\)\\(?:\\(?: (InBase)\\)? : \\(.*\\)$\\)?$")
|
||||
|
||||
(defconst company-clang--error-buffer-name "*clang-error*")
|
||||
|
||||
@@ -138,14 +137,14 @@ or automatically through a custom `company-clang-prefix-guesser'."
|
||||
(regexp-quote prefix)))
|
||||
(case-fold-search nil)
|
||||
(results (make-hash-table :test 'equal :size (/ (point-max) 100)))
|
||||
lines match)
|
||||
lines)
|
||||
(while (re-search-forward pattern nil t)
|
||||
(setq match (match-string-no-properties 1))
|
||||
(unless (equal match "Pattern")
|
||||
(save-match-data
|
||||
(let ((match (match-string-no-properties 1))
|
||||
(meta (match-string-no-properties 2)))
|
||||
(when (equal match "Pattern")
|
||||
(setq match (company-clang--pattern-to-match meta)))
|
||||
(when (string-match ":" match)
|
||||
(setq match (substring match 0 (match-beginning 0)))))
|
||||
(let ((meta (match-string-no-properties 2)))
|
||||
(setq match (substring match 0 (match-beginning 0))))
|
||||
;; Avoiding duplicates:
|
||||
;; https://github.com/company-mode/company-mode/issues/841
|
||||
(cond
|
||||
@@ -154,7 +153,7 @@ or automatically through a custom `company-clang-prefix-guesser'."
|
||||
(puthash match meta results))
|
||||
;; Or it's the first time we see this completion
|
||||
((eq (gethash match results 'none) 'none)
|
||||
(puthash match nil results))))))
|
||||
(puthash match nil results)))))
|
||||
(maphash
|
||||
(lambda (match meta)
|
||||
(when meta
|
||||
@@ -163,6 +162,15 @@ or automatically through a custom `company-clang-prefix-guesser'."
|
||||
results)
|
||||
lines))
|
||||
|
||||
(defun company-clang--pattern-to-match (pat)
|
||||
(let ((start 0)
|
||||
(end nil))
|
||||
(when (string-match "#]" pat)
|
||||
(setq start (match-end 0)))
|
||||
(when (string-match "[ \(]<#" pat start)
|
||||
(setq end (match-beginning 0)))
|
||||
(substring pat start end)))
|
||||
|
||||
(defun company-clang--meta (candidate)
|
||||
(get-text-property 0 'meta candidate))
|
||||
|
||||
@@ -178,6 +186,8 @@ or automatically through a custom `company-clang-prefix-guesser'."
|
||||
(delete-region pt (point)))
|
||||
(buffer-string)))))
|
||||
|
||||
;; TODO: Parse the original formatting here, rather than guess.
|
||||
;; Strip it every time in the `meta' handler instead.
|
||||
(defun company-clang--annotation-1 (candidate)
|
||||
(let ((meta (company-clang--meta candidate)))
|
||||
(cond
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
;;; company-dabbrev-code.el --- dabbrev-like company-mode backend for code -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2009-2011, 2013-2016, 2021 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 2009-2011, 2013-2016, 2021-2023 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Nikolaj Schumacher
|
||||
|
||||
@@ -69,11 +69,29 @@ also `company-dabbrev-code-time-limit'."
|
||||
"Non-nil to ignore case when collecting completion candidates."
|
||||
:type 'boolean)
|
||||
|
||||
(defcustom company-dabbrev-code-completion-styles nil
|
||||
"Non-nil to use the completion styles for fuzzy matching."
|
||||
:type '(choice (const :tag "Prefix matching only" nil)
|
||||
(const :tag "Matching according to `completion-styles'" t)
|
||||
(list :tag "Custom list of styles" symbol)))
|
||||
|
||||
(defun company-dabbrev-code--make-regexp (prefix)
|
||||
(concat "\\_<" (if (equal prefix "")
|
||||
"\\([a-zA-Z]\\|\\s_\\)"
|
||||
(regexp-quote prefix))
|
||||
"\\(\\sw\\|\\s_\\)*\\_>"))
|
||||
(let ((prefix-re
|
||||
(cond
|
||||
((equal prefix "")
|
||||
"\\([a-zA-Z]\\|\\s_\\)")
|
||||
((not company-dabbrev-code-completion-styles)
|
||||
(regexp-quote prefix))
|
||||
(t
|
||||
;; Use the cache at least after 2 chars. We could also cache
|
||||
;; earlier, for users who set company-min-p-l to 1 or 0.
|
||||
(let ((prefix (if (>= (length prefix) 2)
|
||||
(substring prefix 0 2)
|
||||
prefix)))
|
||||
(mapconcat #'regexp-quote
|
||||
(mapcar #'string prefix)
|
||||
"\\(\\sw\\|\\s_\\)*"))))))
|
||||
(concat "\\_<" prefix-re "\\(\\sw\\|\\s_\\)*\\_>")))
|
||||
|
||||
;;;###autoload
|
||||
(defun company-dabbrev-code (command &optional arg &rest _ignored)
|
||||
@@ -88,18 +106,46 @@ comments or strings."
|
||||
(or company-dabbrev-code-everywhere
|
||||
(not (company-in-string-or-comment)))
|
||||
(or (company-grab-symbol) 'stop)))
|
||||
(candidates (let ((case-fold-search company-dabbrev-code-ignore-case))
|
||||
(company-dabbrev--search
|
||||
(company-dabbrev-code--make-regexp arg)
|
||||
company-dabbrev-code-time-limit
|
||||
(pcase company-dabbrev-code-other-buffers
|
||||
(`t (list major-mode))
|
||||
(`code company-dabbrev-code-modes)
|
||||
(`all `all))
|
||||
(not company-dabbrev-code-everywhere))))
|
||||
(candidates
|
||||
(let* ((case-fold-search company-dabbrev-code-ignore-case)
|
||||
(regexp (company-dabbrev-code--make-regexp arg)))
|
||||
(company-dabbrev-code--filter
|
||||
arg
|
||||
(company-cache-fetch
|
||||
'dabbrev-code-candidates
|
||||
(lambda ()
|
||||
(company-dabbrev--search
|
||||
regexp
|
||||
company-dabbrev-code-time-limit
|
||||
(pcase company-dabbrev-code-other-buffers
|
||||
(`t (list major-mode))
|
||||
(`code company-dabbrev-code-modes)
|
||||
(`all `all))
|
||||
(not company-dabbrev-code-everywhere)))
|
||||
:expire t
|
||||
:check-tag regexp))))
|
||||
(kind 'text)
|
||||
(no-cache t)
|
||||
(ignore-case company-dabbrev-code-ignore-case)
|
||||
(match (when company-dabbrev-code-completion-styles
|
||||
(company--match-from-capf-face arg)))
|
||||
(duplicates t)))
|
||||
|
||||
(defun company-dabbrev-code--filter (prefix table)
|
||||
(let ((completion-ignore-case company-dabbrev-code-ignore-case)
|
||||
(completion-styles (if (listp company-dabbrev-code-completion-styles)
|
||||
company-dabbrev-code-completion-styles
|
||||
completion-styles))
|
||||
res)
|
||||
(if (not company-dabbrev-code-completion-styles)
|
||||
(all-completions prefix table)
|
||||
(setq res (completion-all-completions
|
||||
prefix
|
||||
table
|
||||
nil (length prefix)))
|
||||
(if (numberp (cdr (last res)))
|
||||
(setcdr (last res) nil))
|
||||
res)))
|
||||
|
||||
(provide 'company-dabbrev-code)
|
||||
;;; company-dabbrev-code.el ends here
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
;;; company-dabbrev.el --- dabbrev-like company-mode completion backend -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2009-2011, 2013-2018, 2021 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 2009-2011, 2013-2018, 2021-2023 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Nikolaj Schumacher
|
||||
|
||||
@@ -70,10 +70,7 @@ candidate is inserted, even some of its characters have different case."
|
||||
|
||||
The value of nil means keep them as-is.
|
||||
`case-replace' means use the value of `case-replace'.
|
||||
Any other value means downcase.
|
||||
|
||||
If you set this value to nil, you may also want to set
|
||||
`company-dabbrev-ignore-case' to any value other than `keep-prefix'."
|
||||
Any other value means downcase."
|
||||
:type '(choice
|
||||
(const :tag "Keep as-is" nil)
|
||||
(const :tag "Downcase" t)
|
||||
@@ -114,7 +111,7 @@ This variable affects both `company-dabbrev' and `company-dabbrev-code'."
|
||||
(when (and (>= (length match) company-dabbrev-minimum-length)
|
||||
(not (and company-dabbrev-ignore-invisible
|
||||
(invisible-p (match-beginning 0)))))
|
||||
(push match symbols)))))
|
||||
(puthash match t symbols)))))
|
||||
(goto-char (if pos (1- pos) (point-min)))
|
||||
;; Search before pos.
|
||||
(let ((tmp-end (point)))
|
||||
@@ -147,7 +144,9 @@ This variable affects both `company-dabbrev' and `company-dabbrev-code'."
|
||||
(defun company-dabbrev--search (regexp &optional limit other-buffer-modes
|
||||
ignore-comments)
|
||||
(let* ((start (current-time))
|
||||
(symbols (company-dabbrev--search-buffer regexp (point) nil start limit
|
||||
(symbols (company-dabbrev--search-buffer regexp (point)
|
||||
(make-hash-table :test 'equal)
|
||||
start limit
|
||||
ignore-comments)))
|
||||
(when other-buffer-modes
|
||||
(cl-dolist (buffer (delq (current-buffer) (buffer-list)))
|
||||
@@ -175,8 +174,28 @@ This variable affects both `company-dabbrev' and `company-dabbrev-code'."
|
||||
1)))
|
||||
|
||||
(defun company-dabbrev--filter (prefix candidates)
|
||||
(let ((completion-ignore-case company-dabbrev-ignore-case))
|
||||
(all-completions prefix candidates)))
|
||||
(let* ((completion-ignore-case company-dabbrev-ignore-case)
|
||||
(filtered (all-completions prefix candidates))
|
||||
(lp (length prefix))
|
||||
(downcase (if (eq company-dabbrev-downcase 'case-replace)
|
||||
case-replace
|
||||
company-dabbrev-downcase)))
|
||||
(when downcase
|
||||
(let ((ptr filtered))
|
||||
(while ptr
|
||||
(setcar ptr (downcase (car ptr)))
|
||||
(setq ptr (cdr ptr)))))
|
||||
(if (and (eq company-dabbrev-ignore-case 'keep-prefix)
|
||||
(not (= lp 0)))
|
||||
(company-substitute-prefix prefix filtered)
|
||||
filtered)))
|
||||
|
||||
(defun company-dabbrev--fetch ()
|
||||
(company-dabbrev--search (company-dabbrev--make-regexp)
|
||||
company-dabbrev-time-limit
|
||||
(pcase company-dabbrev-other-buffers
|
||||
(`t (list major-mode))
|
||||
(`all `all))))
|
||||
|
||||
;;;###autoload
|
||||
(defun company-dabbrev (command &optional arg &rest _ignored)
|
||||
@@ -186,21 +205,13 @@ This variable affects both `company-dabbrev' and `company-dabbrev-code'."
|
||||
(interactive (company-begin-backend 'company-dabbrev))
|
||||
(prefix (company-dabbrev--prefix))
|
||||
(candidates
|
||||
(let* ((case-fold-search company-dabbrev-ignore-case)
|
||||
(words (company-dabbrev--search (company-dabbrev--make-regexp)
|
||||
company-dabbrev-time-limit
|
||||
(pcase company-dabbrev-other-buffers
|
||||
(`t (list major-mode))
|
||||
(`all `all))))
|
||||
(downcase-p (if (eq company-dabbrev-downcase 'case-replace)
|
||||
case-replace
|
||||
company-dabbrev-downcase)))
|
||||
(setq words (company-dabbrev--filter arg words))
|
||||
(if downcase-p
|
||||
(mapcar 'downcase words)
|
||||
words)))
|
||||
(company-dabbrev--filter
|
||||
arg
|
||||
(company-cache-fetch 'dabbrev-candidates #'company-dabbrev--fetch
|
||||
:expire t)))
|
||||
(kind 'text)
|
||||
(ignore-case company-dabbrev-ignore-case)
|
||||
(no-cache t)
|
||||
(ignore-case (and company-dabbrev-ignore-case t))
|
||||
(duplicates t)))
|
||||
|
||||
(provide 'company-dabbrev)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
;;; company-ispell.el --- company-mode completion backend using Ispell
|
||||
|
||||
;; Copyright (C) 2009-2011, 2013-2016, 2018, 2021 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 2009-2011, 2013-2016, 2018, 2021, 2023 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Nikolaj Schumacher
|
||||
|
||||
@@ -33,30 +33,35 @@
|
||||
"Completion backend using Ispell."
|
||||
:group 'company)
|
||||
|
||||
(defun company--set-dictionary (symbol value)
|
||||
(set-default-toplevel-value symbol value)
|
||||
(company-cache-delete 'ispell-candidates))
|
||||
|
||||
(defcustom company-ispell-dictionary nil
|
||||
"Dictionary to use for `company-ispell'.
|
||||
If nil, use `ispell-complete-word-dict'."
|
||||
:type '(choice (const :tag "default (nil)" nil)
|
||||
(file :tag "dictionary" t)))
|
||||
(file :tag "dictionary" t))
|
||||
:set #'company--set-dictionary)
|
||||
|
||||
(defvar company-ispell-available 'unknown)
|
||||
|
||||
(defalias 'company-ispell--lookup-words
|
||||
(if (fboundp 'ispell-lookup-words)
|
||||
'ispell-lookup-words
|
||||
'lookup-words))
|
||||
|
||||
(defun company-ispell-available ()
|
||||
(when (eq company-ispell-available 'unknown)
|
||||
(condition-case err
|
||||
(progn
|
||||
(company-ispell--lookup-words "WHATEVER")
|
||||
(ispell-lookup-words "WHATEVER")
|
||||
(setq company-ispell-available t))
|
||||
(error
|
||||
(message "Company-Ispell: %s" (error-message-string err))
|
||||
(setq company-ispell-available nil))))
|
||||
company-ispell-available)
|
||||
|
||||
(defun company--ispell-dict ()
|
||||
(or company-ispell-dictionary
|
||||
ispell-complete-word-dict
|
||||
ispell-alternate-dictionary))
|
||||
|
||||
;;;###autoload
|
||||
(defun company-ispell (command &optional arg &rest ignored)
|
||||
"`company-mode' completion backend using Ispell."
|
||||
@@ -66,18 +71,23 @@ If nil, use `ispell-complete-word-dict'."
|
||||
(prefix (when (company-ispell-available)
|
||||
(company-grab-word)))
|
||||
(candidates
|
||||
(let ((words (company-ispell--lookup-words
|
||||
arg
|
||||
(or company-ispell-dictionary ispell-complete-word-dict)))
|
||||
(completion-ignore-case t))
|
||||
(let* ((dict (company--ispell-dict))
|
||||
(all-words
|
||||
(company-cache-fetch 'ispell-candidates
|
||||
(lambda () (ispell-lookup-words "" dict))
|
||||
:check-tag dict))
|
||||
(completion-ignore-case t))
|
||||
(if (string= arg "")
|
||||
;; Small optimization.
|
||||
words
|
||||
;; Work around issue #284.
|
||||
(all-completions arg words))))
|
||||
all-words
|
||||
(company-substitute-prefix
|
||||
arg
|
||||
;; Work around issue #284.
|
||||
(all-completions arg all-words)))))
|
||||
(kind 'text)
|
||||
(no-cache t)
|
||||
(sorted t)
|
||||
(ignore-case 'keep-prefix)))
|
||||
(ignore-case t)))
|
||||
|
||||
(provide 'company-ispell)
|
||||
;;; company-ispell.el ends here
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
;;; company-keywords.el --- A company backend for programming language keywords
|
||||
|
||||
;; Copyright (C) 2009-2011, 2013-2018, 2020-2021 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 2009-2011, 2013-2018, 2020-2022 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Nikolaj Schumacher
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
(define-package "company" "20221206.2122" "Modular text completion framework"
|
||||
(define-package "company" "20231023.1033" "Modular text completion framework"
|
||||
'((emacs "25.1"))
|
||||
:commit "6884e3ad717419b4a64a5fab08c8cb9bd20a0b27" :maintainer
|
||||
'("Dmitry Gutov" . "dgutov@yandex.ru")
|
||||
:commit "66201465a962ac003f320a1df612641b2b276ab5" :maintainers
|
||||
'(("Dmitry Gutov" . "dmitry@gutov.dev"))
|
||||
:maintainer
|
||||
'("Dmitry Gutov" . "dmitry@gutov.dev")
|
||||
:keywords
|
||||
'("abbrev" "convenience" "matching")
|
||||
:url "http://company-mode.github.io/")
|
||||
|
||||
@@ -63,6 +63,7 @@
|
||||
(interactive (company-begin-backend 'company-tempo))
|
||||
(prefix (or (car (tempo-find-match-string tempo-match-finder)) ""))
|
||||
(candidates (all-completions arg (tempo-build-collection)))
|
||||
(kind 'snippet)
|
||||
(meta (company-tempo-meta arg))
|
||||
(post-completion (when company-tempo-expand (company-tempo-insert arg)))
|
||||
(sorted t)))
|
||||
|
||||
@@ -140,7 +140,7 @@ confirm the selection and finish the completion."
|
||||
:type 'boolean)
|
||||
|
||||
;;;###autoload
|
||||
(define-obsolete-function-alias 'company-tng-configure-default 'company-tng-mode "0.9.14"
|
||||
(define-obsolete-function-alias 'company-tng-configure-default 'company-tng-mode "0.10.0"
|
||||
"Applies the default configuration to enable company-tng.")
|
||||
|
||||
(declare-function eglot--snippet-expansion-fn "eglot")
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
;;; company-yasnippet.el --- company-mode completion backend for Yasnippet
|
||||
|
||||
;; Copyright (C) 2014-2015, 2020-2021 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 2014-2015, 2020-2022 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Dmitry Gutov
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
;;; company.el --- Modular text completion framework -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 2009-2023 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Nikolaj Schumacher
|
||||
;; Maintainer: Dmitry Gutov <dgutov@yandex.ru>
|
||||
;; Maintainer: Dmitry Gutov <dmitry@gutov.dev>
|
||||
;; URL: http://company-mode.github.io/
|
||||
;; Version: 0.9.13
|
||||
;; Version: 0.10.2
|
||||
;; Keywords: abbrev, convenience, matching
|
||||
;; Package-Requires: ((emacs "25.1"))
|
||||
|
||||
@@ -134,17 +134,17 @@
|
||||
(defface company-tooltip-quick-access
|
||||
'((default :inherit company-tooltip-annotation))
|
||||
"Face used for the quick-access hints shown in the tooltip."
|
||||
:package-version '(company . "0.9.14"))
|
||||
:package-version '(company . "0.10.0"))
|
||||
|
||||
(defface company-tooltip-quick-access-selection
|
||||
'((default :inherit company-tooltip-annotation-selection))
|
||||
"Face used for the selected quick-access hints shown in the tooltip."
|
||||
:package-version '(company . "0.9.14"))
|
||||
:package-version '(company . "0.10.0"))
|
||||
|
||||
(define-obsolete-face-alias
|
||||
'company-scrollbar-fg
|
||||
'company-tooltip-scrollbar-thumb
|
||||
"0.9.14")
|
||||
"0.10.0")
|
||||
|
||||
(defface company-tooltip-scrollbar-thumb
|
||||
'((((background light))
|
||||
@@ -156,7 +156,7 @@
|
||||
(define-obsolete-face-alias
|
||||
'company-scrollbar-bg
|
||||
'company-tooltip-scrollbar-track
|
||||
"0.9.14")
|
||||
"0.10.0")
|
||||
|
||||
(defface company-tooltip-scrollbar-track
|
||||
'((((background light))
|
||||
@@ -286,7 +286,7 @@ This doesn't include the margins and the scroll bar."
|
||||
(defcustom company-tooltip-width-grow-only nil
|
||||
"When non-nil, the tooltip width is not allowed to decrease."
|
||||
:type 'boolean
|
||||
:package-version '(company . "0.9.14"))
|
||||
:package-version '(company . "0.10.0"))
|
||||
|
||||
(defcustom company-tooltip-margin 1
|
||||
"Width of margin columns to show around the toolip."
|
||||
@@ -309,6 +309,16 @@ This doesn't include the margins and the scroll bar."
|
||||
:type 'boolean
|
||||
:package-version '(company . "0.8.1"))
|
||||
|
||||
(defcustom company-tooltip-annotation-padding nil
|
||||
"Non-nil to specify the padding before annotation.
|
||||
|
||||
Depending on the value of `company-tooltip-align-annotations', the default
|
||||
padding is either 0 or 1 space. This variable allows to override that
|
||||
value to increase the padding. When annotations are right-aligned, it sets
|
||||
the minimum padding, and otherwise just the constant one."
|
||||
:type 'number
|
||||
:package-version '(company "0.10.0"))
|
||||
|
||||
(defvar company-safe-backends
|
||||
'((company-abbrev . "Abbrev")
|
||||
(company-bbdb . "BBDB")
|
||||
@@ -577,12 +587,12 @@ this."
|
||||
(define-obsolete-variable-alias
|
||||
'company-auto-complete
|
||||
'company-insertion-on-trigger
|
||||
"0.9.14")
|
||||
"0.10.0")
|
||||
|
||||
(define-obsolete-variable-alias
|
||||
'company-auto-commit
|
||||
'company-insertion-on-trigger
|
||||
"0.9.14")
|
||||
"0.10.0")
|
||||
|
||||
(defcustom company-insertion-on-trigger nil
|
||||
"If enabled, allow triggering insertion of the selected candidate.
|
||||
@@ -596,17 +606,17 @@ triggers."
|
||||
(const :tag "On, if user interaction took place"
|
||||
company-explicit-action-p)
|
||||
(const :tag "On" t))
|
||||
:package-version '(company . "0.9.14"))
|
||||
:package-version '(company . "0.10.0"))
|
||||
|
||||
(define-obsolete-variable-alias
|
||||
'company-auto-complete-chars
|
||||
'company-insertion-triggers
|
||||
"0.9.14")
|
||||
"0.10.0")
|
||||
|
||||
(define-obsolete-variable-alias
|
||||
'company-auto-commit-chars
|
||||
'company-insertion-triggers
|
||||
"0.9.14")
|
||||
"0.10.0")
|
||||
|
||||
(defcustom company-insertion-triggers '(?\ ?\) ?.)
|
||||
"Determine triggers for `company-insertion-on-trigger'.
|
||||
@@ -638,7 +648,7 @@ insertion."
|
||||
(const :tag "Generic string fence." ?|)
|
||||
(const :tag "Generic comment fence." ?!))
|
||||
(function :tag "Predicate function"))
|
||||
:package-version '(company . "0.9.14"))
|
||||
:package-version '(company . "0.10.0"))
|
||||
|
||||
(defcustom company-idle-delay .2
|
||||
"The idle delay in seconds until completion starts automatically.
|
||||
@@ -692,15 +702,18 @@ commands in the `company-' namespace, abort completion."
|
||||
|
||||
(defun company-custom--set-quick-access (option value)
|
||||
"Re-bind quick-access key sequences on OPTION VALUE change."
|
||||
(when (boundp 'company-active-map)
|
||||
(company-keymap--unbind-quick-access company-active-map))
|
||||
(when (boundp 'company-search-map)
|
||||
(company-keymap--unbind-quick-access company-search-map))
|
||||
;; When upgrading from an earlier version of company, might not be.
|
||||
(when (fboundp #'company-keymap--unbind-quick-access)
|
||||
(when (boundp 'company-active-map)
|
||||
(company-keymap--unbind-quick-access company-active-map))
|
||||
(when (boundp 'company-search-map)
|
||||
(company-keymap--unbind-quick-access company-search-map)))
|
||||
(custom-set-default option value)
|
||||
(when (boundp 'company-active-map)
|
||||
(company-keymap--bind-quick-access company-active-map))
|
||||
(when (boundp 'company-search-map)
|
||||
(company-keymap--bind-quick-access company-search-map)))
|
||||
(when (fboundp #'company-keymap--bind-quick-access)
|
||||
(when (boundp 'company-active-map)
|
||||
(company-keymap--bind-quick-access company-active-map))
|
||||
(when (boundp 'company-search-map)
|
||||
(company-keymap--bind-quick-access company-search-map))))
|
||||
|
||||
(defcustom company-quick-access-keys '("1" "2" "3" "4" "5" "6" "7" "8" "9" "0")
|
||||
"Character strings used as a part of quick-access key sequences.
|
||||
@@ -718,7 +731,7 @@ beside the candidates."
|
||||
;; TODO un-comment on removal of `M-n' `company--select-next-and-warn'.
|
||||
;; (const :tag "Dvorak home row" ("a" "o" "e" "u" "i" "d" "h" "t" "n" "s"))
|
||||
(repeat :tag "User defined" string))
|
||||
:package-version '(company . "0.9.14"))
|
||||
:package-version '(company . "0.10.0"))
|
||||
|
||||
(defcustom company-quick-access-modifier 'meta
|
||||
"Modifier key used for quick-access keys sequences.
|
||||
@@ -729,7 +742,7 @@ See `company-quick-access-keys' for more details."
|
||||
(const :tag "Super key" super)
|
||||
(const :tag "Hyper key" hyper)
|
||||
(const :tag "Control key" control))
|
||||
:package-version '(company . "0.9.14"))
|
||||
:package-version '(company . "0.10.0"))
|
||||
|
||||
(defun company-keymap--quick-access-modifier ()
|
||||
"Return string representation of the `company-quick-access-modifier'."
|
||||
@@ -764,7 +777,7 @@ See `company-quick-access-keys' for more details."
|
||||
(define-obsolete-variable-alias
|
||||
'company-show-numbers
|
||||
'company-show-quick-access
|
||||
"0.9.14")
|
||||
"0.10.0")
|
||||
|
||||
(defcustom company-show-quick-access nil
|
||||
"If non-nil, show quick-access hints beside the candidates.
|
||||
@@ -791,7 +804,7 @@ return a string prefixed with one space."
|
||||
'company-show-numbers-function
|
||||
"use `company-quick-access-hint-function' instead,
|
||||
but adjust the expected values appropriately."
|
||||
"0.9.14")
|
||||
"0.10.0")
|
||||
|
||||
(defcustom company-quick-access-hint-function #'company-quick-access-hint-key
|
||||
"Function called to get quick-access hints for the candidates.
|
||||
@@ -1031,10 +1044,10 @@ means that `company-mode' is always turned on except in `message-mode' buffers."
|
||||
(defun company-install-map ()
|
||||
(unless (or (cdar company-emulation-alist)
|
||||
(null company-my-keymap))
|
||||
(setf (cdar company-emulation-alist) company-my-keymap)))
|
||||
(setq-local company-emulation-alist `((t . ,company-my-keymap)))))
|
||||
|
||||
(defun company-uninstall-map ()
|
||||
(setf (cdar company-emulation-alist) nil))
|
||||
(kill-local-variable 'company-emulation-alist))
|
||||
|
||||
(defun company--company-command-p (keys)
|
||||
"Checks if the keys are part of company's overriding keymap"
|
||||
@@ -1051,6 +1064,10 @@ means that `company-mode' is always turned on except in `message-mode' buffers."
|
||||
(row (cdr (or (posn-actual-col-row posn)
|
||||
;; When position is non-visible for some reason.
|
||||
(posn-col-row posn)))))
|
||||
;; posn-col-row return value relative to the left
|
||||
(when (eq (current-bidi-paragraph-direction) 'right-to-left)
|
||||
(let ((ww (window-body-width)))
|
||||
(setq col (- ww col))))
|
||||
(when (bound-and-true-p display-line-numbers)
|
||||
(cl-decf col (+ 2 (line-number-display-width))))
|
||||
(cons (+ col (window-hscroll)) row)))
|
||||
@@ -1116,6 +1133,69 @@ matches IDLE-BEGIN-AFTER-RE, return it wrapped in a cons."
|
||||
(car (setq ppss (cdr ppss)))
|
||||
(nth 3 ppss))))
|
||||
|
||||
(defun company-substitute-prefix (prefix strings)
|
||||
(let ((len (length prefix)))
|
||||
(mapcar
|
||||
(lambda (s)
|
||||
(if (eq t (compare-strings prefix 0 len s 0 len))
|
||||
s
|
||||
(concat prefix (substring s len))))
|
||||
strings)))
|
||||
|
||||
(defun company--match-from-capf-face (str)
|
||||
"Compute `match' result from a CAPF's completion fontification."
|
||||
(let* ((match-start nil) (pos -1)
|
||||
(prop-value nil) (faces nil)
|
||||
(has-face-p nil) chunks
|
||||
(limit (length str)))
|
||||
(while (< pos limit)
|
||||
(setq pos
|
||||
(if (< pos 0) 0 (next-property-change pos str limit)))
|
||||
(setq prop-value (or (get-text-property pos 'face str)
|
||||
(get-text-property pos 'font-lock-face str))
|
||||
faces (if (listp prop-value) prop-value (list prop-value))
|
||||
has-face-p (memq 'completions-common-part faces))
|
||||
(cond ((and (not match-start) has-face-p)
|
||||
(setq match-start pos))
|
||||
((and match-start (not has-face-p))
|
||||
(push (cons match-start pos) chunks)
|
||||
(setq match-start nil))))
|
||||
(nreverse chunks)))
|
||||
|
||||
(defvar company--cache (make-hash-table :test #'equal :size 10))
|
||||
|
||||
(cl-defun company-cache-fetch (key
|
||||
fetcher
|
||||
&key expire check-tag)
|
||||
"Fetch the value assigned to KEY in the cache.
|
||||
When not found, or when found to be stale, calls FETCHER to compute the
|
||||
result. When EXPIRE is non-nil, the value will be deleted at the end of
|
||||
completion. CHECK-TAG, when present, is saved as well, and the entry will
|
||||
be recomputed when this value changes."
|
||||
;; We could make EXPIRE accept a time value as well.
|
||||
(let ((res (gethash key company--cache 'none))
|
||||
value)
|
||||
(if (and (not (eq res 'none))
|
||||
(or (not check-tag)
|
||||
(equal check-tag (assoc-default :check-tag res))))
|
||||
(assoc-default :value res)
|
||||
(setq res (list (cons :value (setq value (funcall fetcher)))))
|
||||
(if expire (push '(:expire . t) res))
|
||||
(if check-tag (push `(:check-tag . ,check-tag) res))
|
||||
(puthash key res company--cache)
|
||||
value)))
|
||||
|
||||
(defun company-cache-delete (key)
|
||||
"Delete KEY from cache."
|
||||
(remhash key company--cache))
|
||||
|
||||
(defun company-cache-expire ()
|
||||
"Delete all keys from the cache that are set to be expired."
|
||||
(maphash (lambda (k v)
|
||||
(when (assoc-default :expire v)
|
||||
(remhash k company--cache)))
|
||||
company--cache))
|
||||
|
||||
(defun company-call-backend (&rest args)
|
||||
(company--force-sync #'company-call-backend-raw args company-backend))
|
||||
|
||||
@@ -1151,6 +1231,9 @@ matches IDLE-BEGIN-AFTER-RE, return it wrapped in a cons."
|
||||
(error (error "Company: backend %s error \"%s\" with args %s"
|
||||
company-backend (error-message-string err) args))))
|
||||
|
||||
(defvar-local company--multi-uncached-backends nil)
|
||||
(defvar-local company--multi-min-prefix nil)
|
||||
|
||||
(defun company--multi-backend-adapter (backends command &rest args)
|
||||
(let ((backends (cl-loop for b in backends
|
||||
when (or (keywordp b)
|
||||
@@ -1165,9 +1248,30 @@ matches IDLE-BEGIN-AFTER-RE, return it wrapped in a cons."
|
||||
|
||||
(pcase command
|
||||
(`candidates
|
||||
(company--multi-backend-adapter-candidates backends (car args) separate))
|
||||
(company--multi-backend-adapter-candidates backends
|
||||
(car args)
|
||||
(or company--multi-min-prefix 0)
|
||||
separate))
|
||||
(`set-min-prefix (setq company--multi-min-prefix (car args)))
|
||||
(`sorted separate)
|
||||
(`duplicates (not separate))
|
||||
((and `no-cache
|
||||
(pred (lambda (_)
|
||||
(let* (found
|
||||
(uncached company--multi-uncached-backends))
|
||||
(dolist (backend backends)
|
||||
(when
|
||||
(and (member backend uncached)
|
||||
(company--good-prefix-p
|
||||
(let ((company-backend backend))
|
||||
(company-call-backend 'prefix))
|
||||
(or company--multi-min-prefix 0)))
|
||||
(setq found t
|
||||
company--multi-uncached-backends
|
||||
(delete backend
|
||||
company--multi-uncached-backends))))
|
||||
found))))
|
||||
t)
|
||||
((or `prefix `ignore-case `no-cache `require-match)
|
||||
(let (value)
|
||||
(cl-dolist (backend backends)
|
||||
@@ -1184,12 +1288,18 @@ matches IDLE-BEGIN-AFTER-RE, return it wrapped in a cons."
|
||||
(car backends))))
|
||||
(apply backend command args))))))))
|
||||
|
||||
(defun company--multi-backend-adapter-candidates (backends prefix separate)
|
||||
(defun company--multi-backend-adapter-candidates (backends prefix min-length separate)
|
||||
(let ((pairs (cl-loop for backend in backends
|
||||
when (equal (company--prefix-str
|
||||
(let ((company-backend backend))
|
||||
(company-call-backend 'prefix)))
|
||||
prefix)
|
||||
when (let ((bp (let ((company-backend backend))
|
||||
(company-call-backend 'prefix))))
|
||||
(and
|
||||
;; It's important that the lengths match.
|
||||
(equal (company--prefix-str bp) prefix)
|
||||
;; One might override min-length, another not.
|
||||
(if (company--good-prefix-p bp min-length)
|
||||
t
|
||||
(push backend company--multi-uncached-backends)
|
||||
nil)))
|
||||
collect (cons (funcall backend 'candidates prefix)
|
||||
(company--multi-candidates-mapper
|
||||
backend
|
||||
@@ -1346,9 +1456,6 @@ To toggle the value of this variable, call `company-show-doc-buffer' with a
|
||||
prefix argument.")
|
||||
|
||||
(defun company-call-frontends (command)
|
||||
(when (and company-auto-update-doc
|
||||
(memq command '(update show)))
|
||||
(company-show-doc-buffer))
|
||||
(cl-loop for frontend in company-frontends collect
|
||||
(condition-case-unless-debug err
|
||||
(funcall frontend command)
|
||||
@@ -1448,7 +1555,9 @@ update if FORCE-UPDATE."
|
||||
(and candidates
|
||||
(not (cdr candidates))
|
||||
(eq t (compare-strings (car candidates) nil nil
|
||||
prefix nil nil ignore-case))))
|
||||
prefix nil nil ignore-case))
|
||||
(not (eq (company-call-backend 'kind (car candidates))
|
||||
'snippet))))
|
||||
|
||||
(defun company--fetch-candidates (prefix)
|
||||
(let* ((non-essential (not (company-explicit-action-p)))
|
||||
@@ -1620,7 +1729,7 @@ end of the match."
|
||||
(let ((base-size (cdr company-icon-size))
|
||||
(dfh (default-font-height)))
|
||||
(min
|
||||
(if (> dfh (* 2 base-size))
|
||||
(if (>= dfh (* 2 base-size))
|
||||
(* 2 base-size)
|
||||
base-size)
|
||||
(* company-icon-margin dfw))))))
|
||||
@@ -1633,10 +1742,21 @@ end of the match."
|
||||
:background (unless (eq bkg 'unspecified)
|
||||
bkg)))
|
||||
(spacer-px-width (- (* company-icon-margin dfw) icon-size)))
|
||||
(concat
|
||||
(propertize " " 'display spec)
|
||||
(propertize (company-space-string (1- company-icon-margin))
|
||||
'display `(space . (:width (,spacer-px-width))))))
|
||||
(cond
|
||||
((<= company-icon-margin 2)
|
||||
(concat
|
||||
(propertize " " 'display spec)
|
||||
(propertize (company-space-string (1- company-icon-margin))
|
||||
'display `(space . (:width (,spacer-px-width))))))
|
||||
(t
|
||||
(let* ((spacer-left (/ spacer-px-width 2))
|
||||
(spacer-right (- spacer-px-width spacer-left)))
|
||||
(concat
|
||||
(propertize (company-space-string 1)
|
||||
'display `(space . (:width (,spacer-left))))
|
||||
(propertize " " 'display spec)
|
||||
(propertize (company-space-string (- company-icon-margin 2))
|
||||
'display `(space . (:width (,spacer-right)))))))))
|
||||
nil))
|
||||
|
||||
(defun company-vscode-dark-icons-margin (candidate selected)
|
||||
@@ -1943,6 +2063,10 @@ prefix match (same case) will be prioritized."
|
||||
|
||||
;;;###autoload
|
||||
(defun company-manual-begin ()
|
||||
"Start the completion interface.
|
||||
|
||||
Unlike `company-complete-selection' or `company-complete', this command
|
||||
doesn't cause any immediate changes to the buffer text."
|
||||
(interactive)
|
||||
(company-assert-enabled)
|
||||
(setq company--manual-action t)
|
||||
@@ -2021,16 +2145,20 @@ For more details see `company-insertion-on-trigger' and
|
||||
company-candidates)
|
||||
(t (company-cancel))))
|
||||
|
||||
(defun company--good-prefix-p (prefix)
|
||||
(defun company--good-prefix-p (prefix min-length)
|
||||
(and (stringp (company--prefix-str prefix)) ;excludes 'stop
|
||||
(or (eq (cdr-safe prefix) t)
|
||||
(let ((len (or (cdr-safe prefix) (length prefix))))
|
||||
(if company--manual-prefix
|
||||
(or (not company-abort-manual-when-too-short)
|
||||
;; Must not be less than minimum or initial length.
|
||||
(>= len (min company-minimum-prefix-length
|
||||
(length company--manual-prefix))))
|
||||
(>= len company-minimum-prefix-length))))))
|
||||
(>= (or (cdr-safe prefix) (length prefix))
|
||||
min-length))))
|
||||
|
||||
(defun company--prefix-min-length ()
|
||||
(if company--manual-prefix
|
||||
(if company-abort-manual-when-too-short
|
||||
;; Must not be less than minimum or initial length.
|
||||
(min company-minimum-prefix-length
|
||||
(length company--manual-prefix))
|
||||
0)
|
||||
company-minimum-prefix-length))
|
||||
|
||||
(defun company--continue ()
|
||||
(when (company-call-backend 'no-cache company-prefix)
|
||||
@@ -2038,7 +2166,8 @@ For more details see `company-insertion-on-trigger' and
|
||||
(setq company-candidates-cache nil))
|
||||
(let* ((new-prefix (company-call-backend 'prefix))
|
||||
(ignore-case (company-call-backend 'ignore-case))
|
||||
(c (when (and (company--good-prefix-p new-prefix)
|
||||
(c (when (and (company--good-prefix-p new-prefix
|
||||
(company--prefix-min-length))
|
||||
(setq new-prefix (company--prefix-str new-prefix))
|
||||
(= (- (point) (length new-prefix))
|
||||
(- company-point (length company-prefix))))
|
||||
@@ -2067,7 +2196,8 @@ For more details see `company-insertion-on-trigger' and
|
||||
(t (company--continue-failed new-prefix)))))
|
||||
|
||||
(defun company--begin-new ()
|
||||
(let (prefix c)
|
||||
(let ((min-prefix (company--prefix-min-length))
|
||||
prefix c)
|
||||
(cl-dolist (backend (if company-backend
|
||||
;; prefer manual override
|
||||
(list company-backend)
|
||||
@@ -2080,8 +2210,10 @@ For more details see `company-insertion-on-trigger' and
|
||||
(company-call-backend 'prefix)))
|
||||
(company--multi-backend-adapter backend 'prefix)))
|
||||
(when prefix
|
||||
(when (company--good-prefix-p prefix)
|
||||
(when (company--good-prefix-p prefix min-prefix)
|
||||
(let ((ignore-case (company-call-backend 'ignore-case)))
|
||||
;; Keep this undocumented, esp. while only 1 backend needs it.
|
||||
(company-call-backend 'set-min-prefix min-prefix)
|
||||
(setq company-prefix (company--prefix-str prefix)
|
||||
company-backend backend
|
||||
c (company-calculate-candidates company-prefix ignore-case))
|
||||
@@ -2136,7 +2268,10 @@ For more details see `company-insertion-on-trigger' and
|
||||
company--manual-action nil
|
||||
company--manual-prefix nil
|
||||
company--point-max nil
|
||||
company--multi-uncached-backends nil
|
||||
company--multi-min-prefix nil
|
||||
company-point nil)
|
||||
(company-cache-expire)
|
||||
(when company-timer
|
||||
(cancel-timer company-timer))
|
||||
(company-echo-cancel t)
|
||||
@@ -2200,7 +2335,14 @@ For more details see `company-insertion-on-trigger' and
|
||||
(let (company-idle-delay) ; Against misbehavior while debugging.
|
||||
(company--perform)))
|
||||
(if company-candidates
|
||||
(company-call-frontends 'post-command)
|
||||
(progn
|
||||
(company-call-frontends 'post-command)
|
||||
(when company-auto-update-doc
|
||||
(condition-case nil
|
||||
(unless (company--electric-command-p)
|
||||
(company-show-doc-buffer))
|
||||
(user-error nil)
|
||||
(quit nil))))
|
||||
(let ((delay (company--idle-delay)))
|
||||
(and (numberp delay)
|
||||
(not defining-kbd-macro)
|
||||
@@ -2688,12 +2830,13 @@ inserted."
|
||||
(call-interactively 'company-complete-selection)
|
||||
(call-interactively 'company-complete-common)
|
||||
(when company-candidates
|
||||
(setq this-command 'company-complete-common)))))
|
||||
(setq this-command 'company-complete-common)))
|
||||
this-command))
|
||||
|
||||
(define-obsolete-function-alias
|
||||
'company-complete-number
|
||||
'company-complete-tooltip-row
|
||||
"0.9.14")
|
||||
"0.10.0")
|
||||
|
||||
(defun company-complete-tooltip-row (number)
|
||||
"Insert a candidate visible on the tooltip's row NUMBER.
|
||||
@@ -2803,16 +2946,19 @@ from the candidates list.")
|
||||
'(scroll-other-window scroll-other-window-down mwheel-scroll)
|
||||
"List of Commands that won't break out of electric commands.")
|
||||
|
||||
(defun company--electric-command-p ()
|
||||
(memq this-command company--electric-commands))
|
||||
|
||||
(defun company--electric-restore-window-configuration ()
|
||||
"Restore window configuration (after electric commands)."
|
||||
(when (and company--electric-saved-window-configuration
|
||||
(not (memq this-command company--electric-commands)))
|
||||
(not (company--electric-command-p)))
|
||||
(set-window-configuration company--electric-saved-window-configuration)
|
||||
(setq company--electric-saved-window-configuration nil)))
|
||||
|
||||
(defmacro company--electric-do (&rest body)
|
||||
(declare (indent 0) (debug t))
|
||||
`(when (company-manual-begin)
|
||||
`(when company-candidates
|
||||
(cl-assert (null company--electric-saved-window-configuration))
|
||||
(setq company--electric-saved-window-configuration (current-window-configuration))
|
||||
(let ((height (window-height))
|
||||
@@ -2835,11 +2981,7 @@ from the candidates list.")
|
||||
(selection (or company-selection 0)))
|
||||
(let* ((selected (nth selection company-candidates))
|
||||
(doc-buffer (or (company-call-backend 'doc-buffer selected)
|
||||
(if company-auto-update-doc
|
||||
(company-doc-buffer
|
||||
(format "%s: No documentation available"
|
||||
selected))
|
||||
(user-error "No documentation available"))))
|
||||
(user-error "No documentation available")))
|
||||
start)
|
||||
(when (consp doc-buffer)
|
||||
(setq start (cdr doc-buffer)
|
||||
@@ -2856,10 +2998,8 @@ automatically show the documentation buffer for each selection."
|
||||
(interactive "P")
|
||||
(when toggle-auto-update
|
||||
(setq company-auto-update-doc (not company-auto-update-doc)))
|
||||
(if company-auto-update-doc
|
||||
(company--show-doc-buffer)
|
||||
(company--electric-do
|
||||
(company--show-doc-buffer))))
|
||||
(company--electric-do
|
||||
(company--show-doc-buffer)))
|
||||
(put 'company-show-doc-buffer 'company-keep t)
|
||||
|
||||
(defun company-show-location ()
|
||||
@@ -3072,21 +3212,23 @@ If SHOW-VERSION is non-nil, show the version in the echo area."
|
||||
(_ (setq value (company-reformat (company--pre-render value))
|
||||
annotation (and annotation (company--pre-render annotation t))))
|
||||
(ann-ralign company-tooltip-align-annotations)
|
||||
(ann-padding (or company-tooltip-annotation-padding 0))
|
||||
(ann-truncate (< width
|
||||
(+ (length value) (length annotation)
|
||||
(if ann-ralign 1 0))))
|
||||
ann-padding)))
|
||||
(ann-start (+ margin
|
||||
(if ann-ralign
|
||||
(if ann-truncate
|
||||
(1+ (length value))
|
||||
(+ (length value) ann-padding)
|
||||
(- width (length annotation)))
|
||||
(length value))))
|
||||
(+ (length value) ann-padding))))
|
||||
(ann-end (min (+ ann-start (length annotation)) (+ margin width)))
|
||||
(line (concat left
|
||||
(if (or ann-truncate (not ann-ralign))
|
||||
(company-safe-substring
|
||||
(concat value
|
||||
(when (and annotation ann-ralign) " ")
|
||||
(when annotation
|
||||
(company-space-string ann-padding))
|
||||
annotation)
|
||||
0 width)
|
||||
(concat
|
||||
@@ -3225,7 +3367,7 @@ If SHOW-VERSION is non-nil, show the version in the echo area."
|
||||
'company--show-numbers
|
||||
"use `company-quick-access-hint-key' instead,
|
||||
but adjust the expected values appropriately."
|
||||
"0.9.14")
|
||||
"0.10.0")
|
||||
|
||||
(defsubst company--window-height ()
|
||||
(if (fboundp 'window-screen-lines)
|
||||
@@ -3314,6 +3456,9 @@ but adjust the expected values appropriately."
|
||||
(defun company--create-lines (selection limit)
|
||||
(let ((len company-candidates-length)
|
||||
(window-width (company--window-width))
|
||||
(company-tooltip-annotation-padding
|
||||
(or company-tooltip-annotation-padding
|
||||
(if company-tooltip-align-annotations 1 0)))
|
||||
left-margins
|
||||
left-margin-size
|
||||
lines
|
||||
@@ -3386,8 +3531,9 @@ but adjust the expected values appropriately."
|
||||
(setq annotation (string-trim-left annotation))))
|
||||
(push (list value annotation left) items)
|
||||
(setq width (max (+ (length value)
|
||||
(if (and annotation company-tooltip-align-annotations)
|
||||
(1+ (length annotation))
|
||||
(if annotation
|
||||
(+ (length annotation)
|
||||
company-tooltip-annotation-padding)
|
||||
(length annotation)))
|
||||
width))))
|
||||
|
||||
@@ -3610,7 +3756,7 @@ Returns a negative number if the tooltip should be displayed above point."
|
||||
(pre-command (company-pseudo-tooltip-hide-temporarily))
|
||||
(unhide
|
||||
(let ((ov company-pseudo-tooltip-overlay))
|
||||
(when (> (overlay-get ov 'company-height) 0)
|
||||
(when (and ov (> (overlay-get ov 'company-height) 0))
|
||||
;; Sleight of hand: if the current line wraps, we adjust the
|
||||
;; start of the overlay so that the popup does not zig-zag,
|
||||
;; but don't update the popup's background. This seems just
|
||||
@@ -3730,6 +3876,10 @@ Delay is determined by `company-tooltip-idle-delay'."
|
||||
(company-strip-prefix completion)
|
||||
completion))
|
||||
|
||||
(when (string-prefix-p "\n" completion)
|
||||
(setq completion (concat (propertize " " 'face 'company-preview) "\n"
|
||||
(substring completion 1))))
|
||||
|
||||
(and (equal pos (point))
|
||||
(not (equal completion ""))
|
||||
(add-text-properties 0 1 '(cursor 1) completion))
|
||||
@@ -3829,13 +3979,18 @@ Delay is determined by `company-tooltip-idle-delay'."
|
||||
:package-version '(company . "0.9.3"))
|
||||
|
||||
(defun company-echo-show (&optional getter)
|
||||
(when getter
|
||||
(setq company-echo-last-msg (funcall getter)))
|
||||
(let ((message-log-max nil)
|
||||
(let ((last-msg company-echo-last-msg)
|
||||
(message-log-max nil)
|
||||
(message-truncate-lines company-echo-truncate-lines))
|
||||
(if company-echo-last-msg
|
||||
(when getter
|
||||
(setq company-echo-last-msg (funcall getter)))
|
||||
;; Avoid modifying the echo area if we don't have anything to say, and we
|
||||
;; didn't put the previous message there (thus there's nothing to clear),
|
||||
;; https://debbugs.gnu.org/cgi/bugreport.cgi?bug=62816#20
|
||||
(if (not (member company-echo-last-msg '(nil "")))
|
||||
(message "%s" company-echo-last-msg)
|
||||
(message ""))))
|
||||
(unless (member last-msg '(nil ""))
|
||||
(message "")))))
|
||||
|
||||
(defun company-echo-show-soon (&optional getter delay)
|
||||
(company-echo-cancel)
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
This is company.info, produced by makeinfo version 7.0.1 from
|
||||
This is company.info, produced by makeinfo version 6.8 from
|
||||
company.texi.
|
||||
|
||||
This user manual is for Company version 0.9.14snapshot (12 August 2022).
|
||||
This user manual is for Company version 0.10.0 (16 April 2023).
|
||||
|
||||
Copyright © 2021-2022 Free Software Foundation, Inc.
|
||||
Copyright © 2021-2023 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this
|
||||
document under the terms of the GNU Free Documentation License,
|
||||
@@ -26,9 +26,9 @@ The goal of this document is to lay out the foundational knowledge of
|
||||
the package, so that the readers of the manual could competently start
|
||||
adapting Company to their needs and preferences.
|
||||
|
||||
This user manual is for Company version 0.9.14snapshot (12 August 2022).
|
||||
This user manual is for Company version 0.10.0 (16 April 2023).
|
||||
|
||||
Copyright © 2021-2022 Free Software Foundation, Inc.
|
||||
Copyright © 2021-2023 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this
|
||||
document under the terms of the GNU Free Documentation License,
|
||||
@@ -206,8 +206,8 @@ shown according to the typed characters and the default (until a user
|
||||
specifies otherwise) configurations.
|
||||
|
||||
To have Company always enabled for the following sessions, add the line
|
||||
‘(global-company-mode)’ to the Emacs configuration file
|
||||
(*note (emacs)Init File::).
|
||||
‘(global-company-mode)’ to the Emacs configuration file (*note
|
||||
(emacs)Init File::).
|
||||
|
||||
|
||||
File: company.info, Node: Usage Basics, Next: Commands, Prev: Initial Setup, Up: Getting Started
|
||||
@@ -318,9 +318,9 @@ File: company.info, Node: Customization, Next: Frontends, Prev: Getting Start
|
||||
|
||||
Emacs provides two equally acceptable ways for user preferences
|
||||
configuration: via customization interface (for more details, *note
|
||||
(emacs)Easy Customization::) and a configuration file
|
||||
(*note (emacs)Init File::). Naturally, Company can be configured by
|
||||
both of these approaches.
|
||||
(emacs)Easy Customization::) and a configuration file (*note (emacs)Init
|
||||
File::). Naturally, Company can be configured by both of these
|
||||
approaches.
|
||||
|
||||
* Menu:
|
||||
|
||||
@@ -531,6 +531,14 @@ user options.
|
||||
|
||||
| ||||