update packages

This commit is contained in:
2026-06-27 11:34:21 +02:00
parent 4be4f859c4
commit 1aaef48596
246 changed files with 7997 additions and 4359 deletions

View File

@@ -36,7 +36,8 @@
:group 'company)
(defcustom company-capf-disabled-functions '(tags-completion-at-point-function
ispell-completion-at-point)
ispell-completion-at-point
company--fake-capf-complete-common)
"List of completion functions which should be ignored in this backend.
By default it contains the functions that duplicate the built-in backends

View File

@@ -0,0 +1,253 @@
;;; company-childframe.el --- Graphical popup frontend for Company -*- lexical-binding: t -*-
;; Copyright (C) 2026 Free Software Foundation, Inc.
;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;;
;; Tooltip completion menu frontend for Company that uses a child frame.
;;
;; A lot of the code here was imported from the package `company-posframe',
;; credit to Clément Pit-Claudel, Feng Shu and others.
;;; Code:
(require 'company)
(require 'posframe)
(defgroup company-childframe nil
"Group group group"
:group 'company)
(defcustom company-childframe-font nil
"The font used by company-childframe's frame.
Using current frame's font if it is nil."
:type 'face)
(defcustom company-childframe-border-width 1
"The width of the popup's border, in graphical frames.
Users of HiDPI screens might like to set it to 2."
:type 'integer)
(defvar company-childframe-buffer " *company-childframe-buffer*"
"company-childframe's buffer which used by posframe.")
(defvar company-childframe--frame nil)
(defvar company-childframe-show-params nil
"List of extra parameters passed to `posframe-show' in
`company-childframe-show'.")
(defvar company-childframe-last-status nil)
(defvar company-childframe-buffer-map
(let ((keymap (make-sparse-keymap)))
(set-keymap-parent keymap company-active-map)
(define-key keymap [wheel-down] 'company-childframe-wheel-up)
(define-key keymap [wheel-up] 'company-childframe-wheel-down)
keymap)
"Keymap for the child frame's popup/buffer.")
(defun company-childframe-wheel-up ()
"Scroll up the displayed candidates."
(interactive)
(company-childframe--wheel-scroll 3))
(defun company-childframe-wheel-down ()
"Scroll up the displayed candidates."
(interactive)
(company-childframe--wheel-scroll -3))
(defun company-childframe--wheel-scroll (amount)
(let ((parent-frame (frame-parameter nil 'parent-frame))
(parent-buffer (frame-parameter nil 'posframe-parent-buffer)))
(when (and parent-frame
parent-buffer)
(select-frame parent-frame)
(select-window (get-buffer-window (cdr parent-buffer)))
(company-select-next amount))))
(defvar company-childframe-poshandler
#'company-childframe-show-at-prefix
"Poshandler for the completion dialog.")
(defun company-childframe-show-at-prefix (info)
"Poshandler showing `company-childframe' at `company-prefix'."
(let* ((parent-window (plist-get info :parent-window))
(point (- (plist-get info :position)
(plist-get info :company-prefix-length)))
(after-string-width
(with-current-buffer (window-buffer parent-window)
(thread-last
(and (= point (point-max))
(overlays-in point point))
(mapcar (lambda (o) (company--string-pixel-width
(overlay-get o 'after-string))))
(cl-reduce #'+))))
(posn (posn-at-point point parent-window))
;; TODO: Strictly speaking, if company-childframe-font is not nil, that
;; should be used to find the default width...
(expected-margin-width (* (plist-get info :company-margin) (default-font-width)))
(xy (posn-x-y posn)))
(setcar xy (- (car xy) expected-margin-width
(if (display-graphic-p)
company-childframe-border-width
0)
;; Might bite us if the posn-at-point behavior changes
;; someday, but the odds seem low.
after-string-width))
(posframe-poshandler-point-bottom-left-corner (plist-put info :position posn))))
(defun company-childframe-show ()
"Show company-childframe candidate menu."
(defvar x-wait-for-event-timeout)
(defvar x-fast-protocol-requests)
(let* ((x-wait-for-event-timeout (and (>= emacs-major-version 31)
;; debbugs#80662
(bound-and-true-p
x-wait-for-event-timeout)))
(before-make-frame-hook)
(after-make-frame-functions)
(x-fast-protocol-requests t)
(height (min company-tooltip-limit
(if company-search-mode
(1+ company-candidates-length)
company-candidates-length)))
(company-lines (company--create-lines company-selection height))
(margin (car company-lines))
(lines (cdr company-lines))
(width (length (car lines)))
(contents (mapconcat #'identity lines "\n"))
(buffer (get-buffer-create company-childframe-buffer)))
(when (and (eq (frame-live-p company-childframe--frame) 'x)
(not (eq (car (frame-list)) company-childframe--frame)))
;; Make sure it's the first in the list, to avoid premature sync when some
;; other frame is redisplayed first. Again, non-atomic updated on X11.
;; https://debbugs.gnu.org/80662#185
(delete-frame company-childframe--frame))
(apply #'posframe-show buffer
:string contents
:height height
:width (if (or (<= company-candidates-length
height)
(not (display-graphic-p)))
width
(1- width))
:font company-childframe-font
:background-color (face-attribute 'company-tooltip :background)
:lines-truncate t
:override-parameters '((inhibit-double-buffering . t))
:border-width (and (display-graphic-p) company-childframe-border-width)
;; :border-color "light salmon"
;; :border-color "light steel blue"
;; We'll probably want a separate face for it.
:border-color (face-attribute 'company-tooltip-scrollbar-track :background)
:poshandler company-childframe-poshandler
:poshandler-extra-info
(list :company-margin margin
:company-prefix-length (length (car (company--boundaries))))
company-childframe-show-params)
(with-current-buffer buffer
(use-local-map company-childframe-buffer-map)
(setq company-childframe--frame posframe--frame)
;; FIXME: Does not honor remappings by minor modes in the parent buffer,
;; e.g. the special behavior of C-d with parent-mode, etc.
(add-hook 'pre-command-hook
#'company-childframe--pre-command
nil t))))
(defun company-childframe-hide ()
"Hide company-childframe candidate menu."
(when (and (frame-live-p company-childframe--frame)
(frame-visible-p company-childframe--frame))
;; PGTK/NS/W32 protocols can update the display atomically.
(when (and (eq window-system 'x)
;; https://debbugs.gnu.org/80961
(< 32 emacs-major-version))
;; Seems to help avoid the final flicker - probably by keeping the parent's
;; display matrix up to date (so it can repaint on Expose immediately).
(redisplay))
(make-frame-invisible company-childframe--frame)))
;;;###autoload
(defun company-childframe-frontend (command)
"`company-mode' frontend using childframe.
For COMMAND refer to `company-frontends'."
(setq company-childframe-last-status
(list (selected-window)
(current-buffer)))
(cl-case command
(pre-command
(when (not (posframe-workable-p))
(user-error "Child frames not supported")))
(show (setq company--tooltip-current-width 0))
(hide
(company-childframe-hide))
(post-command
(when (equal (window-buffer (selected-window))
(current-buffer))
(company-childframe-show)))
(select-mouse
(company-childframe--select-mouse))))
(defun company-childframe--select-mouse ()
(let ((event-col-row (company--event-col-row company-mouse-event))
(event-window (posn-window (event-start company-mouse-event))))
(cond ((and event-window
(equal (buffer-name (window-buffer event-window))
company-childframe-buffer))
(company-set-selection (+ (cdr event-col-row)
company-tooltip-offset
(if (and (eq company-tooltip-offset-display 'lines)
(not (zerop company-tooltip-offset)))
-1 0)))
t))))
(defun company-childframe--pre-command ()
(let ((parent-frame (frame-parameter nil 'parent-frame))
(parent-buffer (cdr (frame-parameter nil 'posframe-parent-buffer))))
(when (and
(not (memq this-command
'(company-childframe-wheel-up
company-childframe-wheel-down)))
parent-frame parent-buffer)
(select-frame parent-frame)
(select-window (get-buffer-window parent-buffer)))))
;;;###autoload
(defun company-childframe-unless-just-one-frontend (command)
"`company-childframe-frontend', but not shown for single candidates."
(if (company--show-inline-p)
(and (member command '(post-command hide))
(company-childframe-hide))
(and (memq command '(post-command show unhide hide select-mouse))
(company-childframe-frontend command))))
(defun company-childframe-window-change ()
"Hide posframe on window change."
(when (posframe-workable-p)
(unless (or (equal (buffer-name) company-childframe-buffer)
(equal company-childframe-last-status
(list (selected-window)
(current-buffer))))
(company-childframe-hide))))
(add-hook 'window-configuration-change-hook
#'company-childframe-window-change)
(provide 'company-childframe)
;;; company-childframe.el ends here

View File

@@ -1,9 +1,10 @@
;; -*- no-byte-compile: t; lexical-binding: nil -*-
(define-package "company" "20260331.245"
(define-package "company" "20260627.324"
"Modular text completion framework."
'((emacs "26.1"))
'((emacs "26.1")
(posframe "1.5.1"))
:url "http://company-mode.github.io/"
:commit "59626254bbac187fc2b8d7a189aca90976ab36a8"
:revdesc "59626254bbac"
:commit "a703d9f9ce57d37d6b0c073b54348e8b620cebc1"
:revdesc "a703d9f9ce57"
:keywords '("abbrev" "convenience" "matching")
:maintainers '(("Dmitry Gutov" . "dmitry@gutov.dev")))

View File

@@ -1,14 +1,14 @@
;;; company.el --- Modular text completion framework -*- lexical-binding: t -*-
;; Copyright (C) 2009-2025 Free Software Foundation, Inc.
;; Copyright (C) 2009-2026 Free Software Foundation, Inc.
;; Author: Nikolaj Schumacher
;; Maintainer: Dmitry Gutov <dmitry@gutov.dev>
;; URL: http://company-mode.github.io/
;; Package-Version: 20260331.245
;; Package-Revision: 59626254bbac
;; Package-Version: 20260627.324
;; Package-Revision: a703d9f9ce57
;; Keywords: abbrev, convenience, matching
;; Package-Requires: ((emacs "26.1"))
;; Package-Requires: ((emacs "26.1") (posframe "1.5.1"))
;; This file is part of GNU Emacs.
@@ -99,11 +99,11 @@
"Face used for the deprecated items.")
(defface company-tooltip-search
'((default :inherit highlight))
'((default :inherit isearch))
"Face used for the search string in the tooltip.")
(defface company-tooltip-search-selection
'((default :inherit highlight))
'((default :inherit isearch))
"Face used for the search string inside the selection in the tooltip.")
(defface company-tooltip-mouse
@@ -175,7 +175,7 @@
"Face used for the common part of the completion preview.")
(defface company-preview-search
'((default :inherit company-tooltip-common-selection))
'((default :inherit isearch))
"Face used for the search string in the completion preview.")
(defface company-echo nil
@@ -192,21 +192,22 @@
(defun company-frontends-set (variable value)
;; Uniquify.
(let ((value (delete-dups (copy-sequence value))))
(and (or (and (memq 'company-pseudo-tooltip-unless-just-one-frontend value)
(memq 'company-pseudo-tooltip-frontend value))
(and (memq 'company-pseudo-tooltip-unless-just-one-frontend-with-delay value)
(memq 'company-pseudo-tooltip-frontend value))
(and (memq 'company-pseudo-tooltip-unless-just-one-frontend-with-delay value)
(memq 'company-pseudo-tooltip-unless-just-one-frontend value)))
(user-error "Pseudo tooltip frontend cannot be used more than once"))
(and (or (and (memq 'company-preview-if-just-one-frontend value)
(memq 'company-preview-frontend value))
(and (memq 'company-preview-if-just-one-frontend value)
(memq 'company-preview-common-frontend value))
(and (memq 'company-preview-frontend value)
(memq 'company-preview-common-frontend value))
)
(let ((value (delete-dups (copy-sequence value)))
(tooltip-frontends
'(company-pseudo-tooltip-frontend
company-pseudo-tooltip-unless-just-one-frontend
company-pseudo-tooltip-unless-just-one-frontend-with-delay
company-childframe-frontend
company-childframe-unless-just-one-frontend))
(preview-frontends
'(company-preview-if-just-one-frontend
company-preview-common-frontend
company-preview-frontend)))
(and (> (cl-count-if (lambda (el) (member el tooltip-frontends)) value)
1)
(user-error "Any tooltip frontend can be used only once"))
(and (> (cl-count-if (lambda (el) (member el preview-frontends)) value)
1)
(user-error "Preview frontend cannot be used twice"))
(and (memq 'company-echo value)
(memq 'company-echo-metadata-frontend value)
@@ -217,7 +218,11 @@
(setq value (append (delq f value) (list f)))))
(set variable value)))
(defcustom company-frontends '(company-pseudo-tooltip-unless-just-one-frontend
(defcustom company-frontends `(,@(list
(if (or (memq window-system '(ns mac w32 pgtk))
(< 30 emacs-major-version))
'company-childframe-unless-just-one-frontend
'company-pseudo-tooltip-unless-just-one-frontend))
company-preview-if-just-one-frontend
company-echo-metadata-frontend)
"The list of active frontends (visualizations).
@@ -243,20 +248,25 @@ for technical reasons.
The visualized data is stored in `company-prefix', `company-candidates',
`company-common', `company-selection', `company-point' and
`company-search-string'."
:package-version '(company . "1.1.0")
:set 'company-frontends-set
:type '(repeat (choice (const :tag "echo" company-echo-frontend)
(const :tag "echo, strip common"
company-echo-strip-common-frontend)
(const :tag "show echo meta-data in echo"
(const :tag "show completion's meta-data in echo"
company-echo-metadata-frontend)
(const :tag "pseudo tooltip"
(const :tag "graphical tooltip"
company-childframe-frontend)
(const :tag "graphical tooltip, multiple completions only"
company-childframe-unless-just-one-frontend)
(const :tag "overlays based tooltip"
company-pseudo-tooltip-frontend)
(const :tag "pseudo tooltip, multiple only"
(const :tag "overlays based tooltip, multiple completions only"
company-pseudo-tooltip-unless-just-one-frontend)
(const :tag "pseudo tooltip, multiple only, delayed"
(const :tag "overlays based tooltip, multiple completions only, delayed"
company-pseudo-tooltip-unless-just-one-frontend-with-delay)
(const :tag "preview" company-preview-frontend)
(const :tag "preview, unique only"
(const :tag "preview, unique completion only"
company-preview-if-just-one-frontend)
(const :tag "preview, common"
company-preview-common-frontend)
@@ -272,22 +282,22 @@ When that many lines are not available between point and the bottom of the
window, display the tooltip above point."
:type 'integer)
(defcustom company-tooltip-minimum-width 0
(defcustom company-tooltip-minimum-width 15
"The minimum width of the tooltip's inner area.
This doesn't include the margins and the scroll bar."
:type 'integer
:package-version '(company . "0.8.0"))
:package-version '(company . "1.1.0"))
(defcustom company-tooltip-maximum-width most-positive-fixnum
(defcustom company-tooltip-maximum-width 100
"The maximum width of the tooltip's inner area.
This doesn't include the margins and the scroll bar."
:type 'integer
:package-version '(company . "0.9.5"))
:package-version '(company . "1.1.0"))
(defcustom company-tooltip-width-grow-only nil
(defcustom company-tooltip-width-grow-only 50
"When non-nil, the tooltip width is not allowed to decrease."
:type 'boolean
:package-version '(company . "0.10.0"))
:package-version '(company . "1.1.0"))
(defcustom company-tooltip-margin 1
"Width of margin columns to show around the toolip."
@@ -882,15 +892,17 @@ asynchronous call into synchronous.")
;;; mode ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defvar company-mode-map (make-sparse-keymap)
(defvar company-mode-map
(let ((keymap (make-sparse-keymap)))
(define-key keymap [remap indent-for-tab-command] 'company-indent-for-tab-command)
(define-key keymap [remap c-indent-line-or-region] 'company-indent-for-tab-command)
keymap)
"Keymap used by `company-mode'.")
(defvar company-active-map
(let ((keymap (make-sparse-keymap)))
(define-key keymap "\e\e\e" 'company-abort)
(define-key keymap "\C-g" 'company-abort)
(define-key keymap (kbd "M-n") 'company--select-next-and-warn)
(define-key keymap (kbd "M-p") 'company--select-previous-and-warn)
(define-key keymap (kbd "C-n") 'company-select-next-or-abort)
(define-key keymap (kbd "C-p") 'company-select-previous-or-abort)
(define-key keymap (kbd "<down>") 'company-select-next-or-abort)
@@ -908,9 +920,12 @@ asynchronous call into synchronous.")
(define-key keymap [tab] 'company-complete-common-or-cycle)
(define-key keymap (kbd "TAB") 'company-complete-common-or-cycle)
(define-key keymap [backtab] 'company-cycle-backward)
(define-key keymap (kbd "<f1>") 'company-show-doc-buffer)
(define-key keymap (kbd "C-h") 'company-show-doc-buffer)
(define-key keymap "\C-w" 'company-show-location)
(define-key keymap (kbd "C-M-i") 'company-complete-common)
(define-key keymap (kbd "<f1>") 'company--show-doc-buffer-and-warn)
(define-key keymap (kbd "C-h") 'company--show-doc-buffer-and-warn)
(define-key keymap (kbd "M-h") 'company-show-doc-buffer)
(define-key keymap (kbd "C-w") 'company--show-location-and-warn)
(define-key keymap (kbd "M-g") 'company-show-location)
(define-key keymap "\C-s" 'company-search-candidates)
(define-key keymap "\C-\M-s" 'company-filter-candidates)
(company-keymap--bind-quick-access keymap)
@@ -919,22 +934,12 @@ asynchronous call into synchronous.")
(defvar company--disabled-backends nil)
(defun company--select-next-and-warn (&optional arg)
(interactive "p")
(company--warn-changed-binding)
(company-select-next arg))
(defun company--select-previous-and-warn (&optional arg)
(interactive "p")
(company--warn-changed-binding)
(company-select-previous arg))
(defun company--warn-changed-binding ()
(interactive)
(run-with-idle-timer
0.01 nil
(lambda ()
(message "Warning: default bindings are being changed to C-n and C-p"))))
(message "Warning: default bindings are being changed to M-h and M-g"))))
(defun company-init-backend (backend)
(and (symbolp backend)
@@ -974,12 +979,16 @@ asynchronous call into synchronous.")
(defvar company-lighter '(" "
(company-candidates
(:eval
(if (consp company-backend)
(when company-selection
(company--group-lighter (nth company-selection
company-candidates)
company-lighter-base))
(symbol-name company-backend)))
(cond
((consp company-backend)
(when company-selection
(company--group-lighter (nth company-selection
company-candidates)
company-lighter-base)))
((symbolp company-backend)
(symbol-name company-backend))
((functionp company-backend)
"company-<lambda>")))
company-lighter-base))
"Mode line lighter for Company.
@@ -1045,8 +1054,20 @@ means that `company-mode' is always turned on except in `message-mode' buffers."
(const :tag "Except" not)
(repeat :inline t (symbol :tag "mode")))))
(defcustom company-global-minibuffer t
"Non-nil to enable `company-mode' in the minibuffer.
The value can be t (meaning only enable if the minibuffer has a local
`completion-at-point-functions' value) or a custom predicate function.
The overlay based popup is not supported, completion won't start in
minibuffer if it's in configured frontends: use `company-childframe'."
:type 'boolean)
;;;###autoload
(define-globalized-minor-mode global-company-mode company-mode company-mode-on)
(define-globalized-minor-mode global-company-mode company-mode company-mode-on
(if global-company-mode
(add-hook 'minibuffer-setup-hook #'company--minibuffer-on 100)
(remove-hook 'minibuffer-setup-hook #'company--minibuffer-on)))
(defun company-mode-on ()
(when (and (not (or noninteractive (eq (aref (buffer-name) 0) ?\s)))
@@ -1057,6 +1078,14 @@ means that `company-mode' is always turned on except in `message-mode' buffers."
(t (memq major-mode company-global-modes))))
(company-mode 1)))
(defun company--minibuffer-on ()
(when (and company-global-minibuffer
(not (try-completion "company-pseudo-tooltip" company-frontends))
(if (eq company-global-minibuffer t)
(local-variable-p 'completion-at-point-functions)
(funcall company-global-minibuffer)))
(company-mode 1)))
(defsubst company-assert-enabled ()
(unless company-mode
(company-uninstall-map)
@@ -1955,6 +1984,7 @@ end of the match."
(event . "symbol-event.svg")
(field . "symbol-field.svg")
(file . "symbol-file.svg")
(filter . "filter.svg")
(folder . "folder.svg")
(interface . "symbol-interface.svg")
(keyword . "symbol-keyword.svg")
@@ -1965,6 +1995,7 @@ end of the match."
(operator . "symbol-operator.svg")
(property . "symbol-property.svg")
(reference . "references.svg")
(search . "search.svg")
(snippet . "symbol-snippet.svg")
(string . "symbol-string.svg")
(struct . "symbol-structure.svg")
@@ -2068,6 +2099,7 @@ end of the match."
(enum "e" font-lock-builtin-face)
(field "f" font-lock-variable-name-face)
(file "f" font-lock-string-face)
(filter "!" minibuffer-prompt)
(folder "d" font-lock-doc-face)
(interface "i" font-lock-type-face)
(keyword "k" font-lock-keyword-face)
@@ -2078,6 +2110,7 @@ end of the match."
(operator "o" font-lock-comment-delimiter-face)
(property "p" font-lock-variable-name-face)
(reference "r" font-lock-doc-face)
(search "q" minibuffer-prompt)
(snippet "S" font-lock-string-face)
(string "s" font-lock-string-face)
(struct "%" font-lock-variable-name-face)
@@ -2235,7 +2268,7 @@ Searches for each in the currently visible part of the current buffer and
prioritizes the matches according to `company-occurrence-weight-function'.
The rest of the list is appended unchanged.
Keywords and function definition names are ignored."
(let* ((w-start (window-start))
(let* ((w-start (max (window-start) (field-beginning)))
(w-end (window-end))
(start-point (point))
occurs
@@ -2659,7 +2692,12 @@ For more details see `company-insertion-on-trigger' and
(cancel-timer company-timer)
(setq company-timer nil))
(company-echo-cancel t)
(company-uninstall-map))
(unless (memq this-original-command
'(describe-key
describe-key-briefly
describe-map
describe-bindings))
(company-uninstall-map)))
(defun company-post-command ()
(when (and company-candidates
@@ -2727,7 +2765,7 @@ For more details see `company-insertion-on-trigger' and
;;; search ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defcustom company-search-regexp-function #'regexp-quote
(defcustom company-search-regexp-function #'company-search-words-in-any-order-regexp
"Function to construct the search regexp from input.
It's called with one argument, the current search input. It must return
either a regexp without groups, or one where groups don't intersect and
@@ -2738,10 +2776,13 @@ each one wraps a part of the input string."
(const :tag "Words separated with spaces, in any order"
company-search-words-in-any-order-regexp)
(const :tag "All characters in given order, with anything in between"
company-search-flex-regexp)))
company-search-flex-regexp)
(const :tag "Space separated words in any order, all chars inside a word with anything in between"
company-search-flex-words-in-any-order-regexp)))
(defvar-local company-search-string "")
;; FIXME: Delete later.
(defvar company-search-lighter '(" "
(company-search-filtering "Filter" "Search")
": \""
@@ -2771,12 +2812,23 @@ each one wraps a part of the input string."
(defun company-search-flex-regexp (input)
(if (zerop (length input))
""
(concat (regexp-quote (string (aref input 0)))
(concat (format "\\(%s\\)" (regexp-quote (string (aref input 0))))
(mapconcat (lambda (c)
(concat "[^" (string c) "]*"
(regexp-quote (string c))))
(format "\\(%s\\)"
(regexp-quote (string c)))))
(substring input 1) ""))))
(defun company-search-flex-words-in-any-order-regexp (input)
(let* ((words (mapcar (lambda (word) (format "\\(?:%s\\)"
(company-search-flex-regexp word)))
(split-string input " +" t)))
(permutations (company--permutations words)))
(mapconcat (lambda (words)
(mapconcat #'identity words ".*"))
permutations
"\\|")))
(defun company--permutations (lst)
(if (not lst)
'(nil)
@@ -2827,9 +2879,16 @@ each one wraps a part of the input string."
(let* ((selection (or company-selection 0))
(pos (company--search new (nthcdr selection company-candidates))))
(if (null pos)
(let ((pos (company--search new (nthcdr (- company-candidates-length
selection)
(reverse company-candidates)))))
(if (null pos)
(ding)
(setq company-search-string new)
(company-set-selection (- selection pos 1) t)))
(ding)
(setq company-search-string new)
(company-set-selection (+ selection pos) t))))
(setq company-search-string new)
(company-set-selection (+ selection pos) t))))
(defun company--search-assert-input ()
(company--search-assert-enabled)
@@ -2842,7 +2901,7 @@ each one wraps a part of the input string."
(company--search-assert-input)
(let* ((selection (or company-selection 0))
(pos (company--search company-search-string
(cdr (nthcdr selection company-candidates)))))
(cdr (nthcdr selection company-candidates)))))
(if (null pos)
(ding)
(company-set-selection (+ selection pos 1) t))))
@@ -2941,7 +3000,7 @@ each one wraps a part of the input string."
"Search mode for completion candidates.
Don't start this directly, use `company-search-candidates' or
`company-filter-candidates'."
:lighter company-search-lighter
:lighter nil
(if company-search-mode
(if (company-manual-begin)
(progn
@@ -2989,8 +3048,8 @@ uses the search string to filter the completion candidates."
This works the same way as `company-search-candidates' immediately
followed by `company-search-toggle-filtering'."
(interactive)
(company-search-mode 1)
(setq company-search-filtering t))
(setq company-search-filtering t)
(company-search-mode 1))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -3527,6 +3586,25 @@ from the candidates list.")
(let ((win (display-buffer doc-buffer t)))
(set-window-start win (if start start (point-min)))))))
(defun company--fake-capf-complete-common (&rest _)
(company-complete-common)
(list (point) (point) nil))
(defun company-indent-for-tab-command (&optional arg)
"Like `indent-for-tab-command' which see but calls `company-complete-common'
instead of `completion-at-point' as the fallback. That only happens when
`tab-always-indent' is `complete', and only when reindentation was a no-op."
(interactive)
(unwind-protect
(progn
(add-hook 'completion-at-point-functions
#'company--fake-capf-complete-common
nil t)
(funcall-interactively #'indent-for-tab-command arg))
(remove-hook 'completion-at-point-functions
#'company--fake-capf-complete-common
t)))
(defun company-show-doc-buffer (&optional toggle-auto-update)
"Show the documentation buffer for the selection.
With a prefix argument TOGGLE-AUTO-UPDATE, toggle the value of
@@ -3539,6 +3617,12 @@ automatically show the documentation buffer for each selection."
(company--show-doc-buffer)))
(put 'company-show-doc-buffer 'company-keep t)
(defun company--show-doc-buffer-and-warn (&optional toggle-auto-update)
(interactive "P")
(company--warn-changed-binding)
(company-show-doc-buffer toggle-auto-update))
(put 'company--show-doc-buffer-and-warn 'company-keep t)
(defun company-show-location ()
"Temporarily display a buffer showing the selected candidate in context."
(interactive)
@@ -3560,6 +3644,12 @@ automatically show the documentation buffer for each selection."
(set-window-start nil (point)))))))
(put 'company-show-location 'company-keep t)
(defun company--show-location-and-warn ()
(interactive)
(company--warn-changed-binding)
(company-show-location))
(put 'company--show-location-and-warn 'company-keep t)
;;; package functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defvar-local company-callback nil)
@@ -4055,6 +4145,8 @@ but adjust the expected values appropriately."
previous
remainder
scrollbar-bounds)
(when company-search-mode
(cl-decf limit))
;; Maybe clear old offset.
(when (< len (+ company-tooltip-offset limit))
@@ -4131,7 +4223,13 @@ but adjust the expected values appropriately."
width))))
(when company-tooltip-width-grow-only
(setq width (max company--tooltip-current-width width))
(setq width (max
(min
(if (numberp company-tooltip-width-grow-only)
company-tooltip-width-grow-only
most-positive-fixnum)
company--tooltip-current-width)
width))
(setq company--tooltip-current-width width))
(let ((items (nreverse items))
@@ -4169,6 +4267,10 @@ but adjust the expected values appropriately."
(when remainder
(push (company--scrollpos-line remainder width left-margin-size) new))
(when company-search-mode
(push (company--search-line width right-margin)
new))
(cons
left-margin-size
(nreverse new)))))
@@ -4221,6 +4323,29 @@ Value of SELECTED determines the added face."
'company-tooltip-quick-access-selection
'company-tooltip-quick-access)))
(defun company--search-line (width right-margin)
(let* ((company-backend (lambda (command &rest _)
(and (eq command 'kind)
(if company-search-filtering
'filter
'search))))
(left (if company-format-margin-function
(funcall company-format-margin-function "" nil)
(concat
(company-space-string company-tooltip-margin)
(format "%s: " (company-call-backend 'kind)))))
(line (concat
company-search-string))
(width (+ (company--string-width left) width (length right-margin))))
(unless (display-graphic-p) (cl-incf width))
(setq line (company-safe-substring (concat left
(propertize
company-search-string
'face 'underline))
0 width))
(add-face-text-property 0 width 'company-tooltip nil line)
line))
;; show
(defvar-local company-pseudo-tooltip-overlay nil)
@@ -4244,7 +4369,10 @@ Value of SELECTED determines the added face."
Returns a negative number if the tooltip should be displayed above point."
(let* ((lines (company--row))
(below (- (company--window-height) 1 lines)))
(if (and (< below (min company-tooltip-minimum company-candidates-length))
(if (and (< below (min company-tooltip-minimum
(if company-search-mode
(1+ company-candidates-length)
company-candidates-length)))
(> lines below))
(- (max 3 (min company-tooltip-limit lines)))
(max 3 (min company-tooltip-limit below)))))
@@ -4468,6 +4596,9 @@ Delay is determined by `company-tooltip-idle-delay'."
(defvar-local company-preview-overlay nil)
(defun company-preview-show-at-point (pos completion &optional boundaries)
(when (minibufferp)
(company-echo-hide))
(company-preview-hide)
(let* ((boundaries (or boundaries (company--boundaries completion)))
@@ -4528,6 +4659,8 @@ Delay is determined by `company-tooltip-idle-delay'."
(let ((ov company-preview-overlay))
(overlay-put ov (if (> end beg) 'display 'after-string)
completion)
;; Show before minibuffer-message-overlay if there.
(overlay-put ov 'priority 1101)
(overlay-put ov 'window (selected-window))))))
(defun company-preview-hide ()
@@ -4607,9 +4740,31 @@ Delay is determined by `company-tooltip-idle-delay'."
(defun company-echo-show (&optional getter)
(let ((last-msg company-echo-last-msg)
(message-log-max nil)
(preview-o company-preview-overlay)
(message-truncate-lines company-echo-truncate-lines))
(when getter
(setq company-echo-last-msg (funcall getter)))
(when-let* ((mini-window (and company-echo-truncate-lines
(active-minibuffer-window)))
(posn (posn-at-point
(with-current-buffer (window-buffer mini-window)
(max (point-min)
(1- (point-max))))
mini-window))
(max-len (max 0
(- (window-width mini-window)
(car
(posn-col-row posn))
(if preview-o
(company--string-width
(or
(overlay-get preview-o 'display)
(overlay-get preview-o 'after-string)
""))
0)
5))))
(when (> (length company-echo-last-msg) max-len)
(setq company-echo-last-msg (substring company-echo-last-msg 0 max-len))))
;; 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
@@ -4695,8 +4850,7 @@ Delay is determined by `company-tooltip-idle-delay'."
(defun company-echo-hide ()
(unless (string-empty-p company-echo-last-msg)
(setq company-echo-last-msg "")
(company-echo-show)))
(company-echo-show #'ignore)))
(defun company-echo-frontend (command)
"`company-mode' frontend showing the candidates in the echo area."
@@ -4713,9 +4867,35 @@ Delay is determined by `company-tooltip-idle-delay'."
(defun company-echo-metadata-frontend (command)
"`company-mode' frontend showing the documentation in the echo area."
(pcase command
(`pre-command
(when (and (> company-echo-delay 0)
(or (not (minibufferp))
(memq this-command
'(self-insert-command
delete-backward-char
company-select-next
company-select-previous
company-select-next-or-abort
company-select-previous-or-abort
company-next-page
company-previous-page
company-search-repeat-forward
company-search-repeat-backward
company-complete-common-or-cycle))))
(company-echo-show)))
(`post-command (company-echo-show-soon 'company-fetch-metadata))
(`unhide (company-echo-show))
(`hide (company-echo-hide))))
(eldoc-add-command-completions "company-")
(defun company--eldoc-no-inteference-p ()
(or (not company-candidates)
(member company-echo-last-msg '(nil ""))))
(advice-add #'eldoc-display-message-no-interference-p
:after-while
#'company--eldoc-no-inteference-p)
(provide 'company)
;;; company.el ends here

View File

@@ -9,7 +9,8 @@ Copyright © 2021-2024 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU Free Documentation License,
Version 1.3 or any later version published by the Free Software
Foundation.
Foundation, with no Invariant Sections, no Front-Cover Texts, and
no Back-Cover Texts.
INFO-DIR-SECTION Emacs misc features
START-INFO-DIR-ENTRY
* Company: (company). A modular text completion framework.
@@ -35,7 +36,8 @@ Copyright © 2021-2024 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU Free Documentation License,
Version 1.3 or any later version published by the Free Software
Foundation.
Foundation, with no Invariant Sections, no Front-Cover Texts, and
no Back-Cover Texts.
* Menu:
@@ -1773,45 +1775,45 @@ Concept Index

Tag Table:
Node: Top573
Node: Overview1999
Node: Terminology2407
Node: Structure3710
Node: Getting Started5200
Node: Installation5478
Node: Initial Setup5861
Node: Usage Basics6709
Node: Commands7683
Ref: Commands-Footnote-110079
Node: Customization10246
Node: Customization Interface10718
Node: Configuration File11251
Ref: company-selection-wrap-around13565
Node: Frontends16054
Node: Tooltip Frontends17023
Ref: Tooltip Frontends-Footnote-127719
Node: Preview Frontends27956
Ref: Preview Frontends-Footnote-129214
Node: Echo Frontends29341
Node: Candidates Search30870
Node: Filter Candidates32202
Node: Quick Access a Candidate32982
Node: Backends34600
Node: Backends Usage Basics35630
Ref: Backends Usage Basics-Footnote-137062
Node: Grouped Backends37146
Node: Package Backends38657
Node: Code Completion39584
Node: Text Completion45101
Node: File Name Completion49525
Node: Template Expansion51071
Node: Candidates Post-Processing51790
Node: Troubleshooting54367
Node: Index56038
Node: Key Index56201
Node: Variable Index57700
Node: Function Index62553
Node: Concept Index67253
Node: Top653
Node: Overview2159
Node: Terminology2567
Node: Structure3870
Node: Getting Started5360
Node: Installation5638
Node: Initial Setup6021
Node: Usage Basics6869
Node: Commands7843
Ref: Commands-Footnote-110239
Node: Customization10406
Node: Customization Interface10878
Node: Configuration File11411
Ref: company-selection-wrap-around13725
Node: Frontends16214
Node: Tooltip Frontends17183
Ref: Tooltip Frontends-Footnote-127879
Node: Preview Frontends28116
Ref: Preview Frontends-Footnote-129374
Node: Echo Frontends29501
Node: Candidates Search31030
Node: Filter Candidates32362
Node: Quick Access a Candidate33142
Node: Backends34760
Node: Backends Usage Basics35790
Ref: Backends Usage Basics-Footnote-137222
Node: Grouped Backends37306
Node: Package Backends38817
Node: Code Completion39744
Node: Text Completion45261
Node: File Name Completion49685
Node: Template Expansion51231
Node: Candidates Post-Processing51950
Node: Troubleshooting54527
Node: Index56198
Node: Key Index56361
Node: Variable Index57860
Node: Function Index62713
Node: Concept Index67413

End Tag Table

View File

@@ -0,0 +1,3 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M15 2V3.66963L10 8.42874V14H6V8.42874L1 3.66963V2H15ZM7 8V13H9V8L14 3.24089V3H2V3.24089L7 8Z" fill="#C5C5C5"/>
</svg>

After

Width:  |  Height:  |  Size: 263 B

View File

@@ -0,0 +1,3 @@
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M15.25 1.02546e-06C13.6605 -0.000791296 12.1046 0.457574 10.7694 1.32007C9.43422 2.18256 8.37657 3.4124 7.72375 4.8617C7.07094 6.31099 6.85077 7.91801 7.0896 9.4895C7.32843 11.061 8.01604 12.5301 9.06995 13.72L1 22.88L2.12 23.88L10.17 14.76C11.2055 15.5693 12.4192 16.1196 13.7103 16.365C15.0014 16.6104 16.3325 16.5437 17.5927 16.1707C18.8528 15.7976 20.0055 15.1288 20.955 14.2201C21.9044 13.3114 22.623 12.1891 23.0509 10.9465C23.4789 9.70396 23.6038 8.37703 23.4153 7.07642C23.2267 5.77581 22.7302 4.53915 21.967 3.46924C21.2039 2.39933 20.1962 1.52711 19.0278 0.925416C17.8595 0.323719 16.5642 0.00991516 15.25 0.0100108V1.02546e-06ZM15.25 15C13.915 15 12.6099 14.6041 11.4999 13.8624C10.3898 13.1207 9.52469 12.0665 9.01379 10.8331C8.5029 9.59973 8.36919 8.24248 8.62964 6.93311C8.89009 5.62373 9.53305 4.42106 10.4771 3.47705C11.4211 2.53305 12.6237 1.89009 13.9331 1.62964C15.2425 1.36919 16.5997 1.5029 17.8331 2.01379C19.0665 2.52469 20.1207 3.38985 20.8624 4.49988C21.6041 5.60991 22 6.91498 22 8.25C22 10.0402 21.2888 11.7571 20.0229 13.023C18.7571 14.2888 17.0402 15 15.25 15Z" fill="#C5C5C5"/>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -0,0 +1,3 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M15.0002 2V3.66963L10.0002 8.42874V14H6.00024V8.42874L1.00024 3.66963V2H15.0002ZM7.00024 8V13H9.00024V8L14.0002 3.24089V3H2.00024V3.24089L7.00024 8Z" fill="#424242"/>
</svg>

After

Width:  |  Height:  |  Size: 319 B

View File

@@ -0,0 +1,3 @@
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M15.2502 1.02546e-06C13.6607 -0.000791296 12.1048 0.457574 10.7697 1.32007C9.43447 2.18256 8.37681 3.4124 7.724 4.8617C7.07118 6.31099 6.85102 7.91801 7.08984 9.4895C7.32867 11.061 8.01628 12.5301 9.07019 13.72L1.00024 22.88L2.12024 23.88L10.1703 14.76C11.2057 15.5693 12.4195 16.1196 13.7106 16.365C15.0017 16.6104 16.3328 16.5437 17.5929 16.1707C18.853 15.7976 20.0058 15.1288 20.9552 14.2201C21.9046 13.3114 22.6232 12.1891 23.0511 10.9465C23.4791 9.70396 23.6041 8.37703 23.4155 7.07642C23.227 5.77581 22.7304 4.53915 21.9673 3.46924C21.2041 2.39933 20.1964 1.52711 19.0281 0.925416C17.8597 0.323719 16.5644 0.00991516 15.2502 0.0100108V1.02546e-06ZM15.2502 15C13.9152 15 12.6102 14.6041 11.5001 13.8624C10.3901 13.1207 9.52493 12.0665 9.01404 10.8331C8.50315 9.59973 8.36943 8.24248 8.62988 6.93311C8.89033 5.62373 9.53329 4.42106 10.4773 3.47705C11.4213 2.53305 12.624 1.89009 13.9333 1.62964C15.2427 1.36919 16.6 1.5029 17.8334 2.01379C19.0668 2.52469 20.121 3.38985 20.8627 4.49988C21.6044 5.60991 22.0002 6.91498 22.0002 8.25C22.0002 10.0402 21.2891 11.7571 20.0232 13.023C18.7573 14.2888 17.0405 15 15.2502 15Z" fill="#424242"/>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB