dotemacs

My Emacs configuration
git clone git://git.entf.net/dotemacs
Log | Files | Refs | LICENSE

company.info (74761B)


      1 This is docv3QUJv.info, produced by makeinfo version 6.8 from
      2 company.texi.
      3 
      4 This user manual is for Company version 0.10.0 (16 April 2023).
      5 
      6 Copyright © 2021-2023 Free Software Foundation, Inc.
      7 
      8      Permission is granted to copy, distribute and/or modify this
      9      document under the terms of the GNU Free Documentation License,
     10      Version 1.3 or any later version published by the Free Software
     11      Foundation.
     12 INFO-DIR-SECTION Emacs misc features
     13 START-INFO-DIR-ENTRY
     14 * Company: (company).           A modular text completion framework.
     15 END-INFO-DIR-ENTRY
     16 
     17 
     18 File: docv3QUJv.info,  Node: Top,  Next: Overview,  Up: (dir)
     19 
     20 Company
     21 *******
     22 
     23 Company is a modular text completion framework for GNU Emacs.
     24 
     25 The goal of this document is to lay out the foundational knowledge of
     26 the package, so that the readers of the manual could competently start
     27 adapting Company to their needs and preferences.
     28 
     29 This user manual is for Company version 0.10.0 (16 April 2023).
     30 
     31 Copyright © 2021-2023 Free Software Foundation, Inc.
     32 
     33      Permission is granted to copy, distribute and/or modify this
     34      document under the terms of the GNU Free Documentation License,
     35      Version 1.3 or any later version published by the Free Software
     36      Foundation.
     37 
     38 * Menu:
     39 
     40 * Overview:: Terminology and Structure
     41 * Getting Started:: Quick Start Guide
     42 * Customization:: User Options
     43 * Frontends:: Frontends Usage Instructions
     44 * Backends:: Backends Usage Instructions
     45 * Troubleshooting:: When Something Goes Wrong
     46 * Index::
     47 
     48 — The Detailed Node Listing —
     49 
     50 Overview
     51 
     52 * Terminology::
     53 * Structure::
     54 
     55 Getting Started
     56 
     57 * Installation::
     58 * Initial Setup::
     59 * Usage Basics::
     60 * Commands::
     61 
     62 Customization
     63 
     64 * Customization Interface::
     65 * Configuration File::
     66 
     67 Frontends
     68 
     69 * Tooltip Frontends::
     70 * Preview Frontends::
     71 * Echo Frontends::
     72 * Candidates Search::
     73 * Filter Candidates::
     74 * Quick Access a Candidate::
     75 
     76 Backends
     77 
     78 * Backends Usage Basics::
     79 * Grouped Backends::
     80 * Package Backends::
     81 * Candidates Post-Processing::
     82 
     83 
     84 
     85 File: docv3QUJv.info,  Node: Overview,  Next: Getting Started,  Prev: Top,  Up: Top
     86 
     87 1 Overview
     88 **********
     89 
     90 “Company” is a modular text completion framework for GNU Emacs.
     91 
     92 In other words, it is a package for retrieving, manipulating, and
     93 displaying text completion candidates.  It aims to assist developers,
     94 writers, and scientists during code and text writing.
     95 
     96 * Menu:
     97 
     98 * Terminology::
     99 * Structure::
    100 
    101 
    102 File: docv3QUJv.info,  Node: Terminology,  Next: Structure,  Up: Overview
    103 
    104 1.1 Terminology
    105 ===============
    106 
    107 “Completion” is an act of intelligibly guessing possible variants of
    108 words based on already typed characters.  To “complete” a word means to
    109 insert a correctly guessed variant into the buffer.
    110 
    111 Consequently, the “candidates” are the aforementioned guessed variants
    112 of words.  Each of the candidates has the potential to be chosen for
    113 successful completion.  And each of the candidates contains the
    114 initially typed characters: either only at the beginning (so-called
    115 “prefix matches”), or also inside (“non-prefix matches”) of a candidate
    116 (1).
    117 
    118 The package’s name “Company” is based on the combination of the two
    119 words: ‘Complete’ and ‘Anything’.  These words reflect the package’s
    120 commitment to handling completion candidates and its extensible nature
    121 allowing it to cover a wide range of usage scenarios.
    122 
    123    ---------- Footnotes ----------
    124 
    125    (1) A good starting point to learn about types of matches is to play
    126 with the Emacs’s user option ‘completion-styles’.  For illustrations on
    127 how Company visualizes the matches, *note Frontends::.
    128 
    129 
    130 File: docv3QUJv.info,  Node: Structure,  Prev: Terminology,  Up: Overview
    131 
    132 1.2 Structure
    133 =============
    134 
    135 The Company is easily extensible because its significant building blocks
    136 are pluggable modules: backends (*note Backends::) and frontends (*note
    137 Frontends::).
    138 
    139 The “backends” are responsible for retrieving completion candidates;
    140 which are then outputted by the “frontends”.  For an easy and quick
    141 initial setup, Company is supplied with the preconfigured sets of the
    142 backends and frontends.  The default behavior of the modules can be
    143 adjusted per particular needs, goals, and preferences.  It is also
    144 typical to utilize backends from a variety of third-party libraries
    145 (https://github.com/company-mode/company-mode/wiki/Third-Party-Packages),
    146 developed to be pluggable with Company.
    147 
    148 But Company consists not only of the backends and frontends.
    149 
    150 A core of the package plays the role of a controller, connecting the
    151 modules, making them work together; and exposing configurations and
    152 commands for a user to operate with.  For more details, *note
    153 Customization:: and *note Commands::.
    154 
    155 Also, Company is bundled with an alternative workflow configuration
    156 “company-tng” — defining ‘company-tng-frontend’, ‘company-tng-mode’, and
    157 ‘company-tng-map’ — that allows performing completion with just <TAB>.
    158 To enable this configuration, add the following line to the Emacs
    159 initialization file (*note (emacs)Init File::):
    160 
    161      (add-hook 'after-init-hook 'company-tng-mode)
    162 
    163 
    164 File: docv3QUJv.info,  Node: Getting Started,  Next: Customization,  Prev: Overview,  Up: Top
    165 
    166 2 Getting Started
    167 *****************
    168 
    169 This chapter provides basic instructions for Company setup and usage.
    170 
    171 * Menu:
    172 
    173 * Installation::
    174 * Initial Setup::
    175 * Usage Basics::
    176 * Commands::
    177 
    178 
    179 File: docv3QUJv.info,  Node: Installation,  Next: Initial Setup,  Up: Getting Started
    180 
    181 2.1 Installation
    182 ================
    183 
    184 Company package is distributed via commonly used package archives in a
    185 form of both stable and development releases.  To install Company, type
    186 ‘M-x package-install <RET> company <RET>’.
    187 
    188 For more details on Emacs package archives, *note (emacs)Packages::.
    189 
    190 
    191 File: docv3QUJv.info,  Node: Initial Setup,  Next: Usage Basics,  Prev: Installation,  Up: Getting Started
    192 
    193 2.2 Initial Setup
    194 =================
    195 
    196 The package Company provides a minor mode “company-mode”.
    197 
    198 To activate the _company-mode_, execute the command ‘M-x company-mode’
    199 that toggles the mode on and off.  When it is switched on, the mode line
    200 (*note (emacs)Mode line::) should indicate its presence with an
    201 indicator ‘company’.
    202 
    203 After _company-mode_ had been enabled, the package auto-starts
    204 suggesting completion candidates.  The candidates are retrieved and
    205 shown according to the typed characters and the default (until a user
    206 specifies otherwise) configurations.
    207 
    208 To have Company always enabled for the following sessions, add the line
    209 ‘(global-company-mode)’ to the Emacs configuration file (*note
    210 (emacs)Init File::).
    211 
    212 
    213 File: docv3QUJv.info,  Node: Usage Basics,  Next: Commands,  Prev: Initial Setup,  Up: Getting Started
    214 
    215 2.3 Usage Basics
    216 ================
    217 
    218 By default — having _company-mode_ enabled (*note Initial Setup::) — a
    219 tooltip with completion candidates is shown when a user types in a few
    220 characters.
    221 
    222 To initiate completion manually, use the command ‘M-x company-complete’.
    223 
    224 To select next or previous of the shown completion candidates, use
    225 respectively key bindings ‘C-n’ and ‘C-p’, then do one of the following:
    226 
    227    • Hit <RET> to choose a selected candidate for completion.
    228 
    229    • Hit <TAB> to complete with the “common part”: characters present at
    230      the beginning of all the candidates.
    231 
    232    • Hit ‘C-g’ to stop activity of Company.
    233 
    234 
    235 File: docv3QUJv.info,  Node: Commands,  Prev: Usage Basics,  Up: Getting Started
    236 
    237 2.4 Commands
    238 ============
    239 
    240 Under the hood, mentioned in the previous section keys are bound to the
    241 commands of the out-of-the-box Company.
    242 
    243 ‘C-n’
    244 ‘M-n’
    245      Select the next candidate (‘company-select-next-or-abort’,
    246      ‘company-select-next’).
    247 
    248 ‘C-p’
    249 ‘M-p’
    250      Select the previous candidate (‘company-select-previous-or-abort’,
    251      ‘company-select-previous’).
    252 
    253 ‘RET’
    254 ‘<return>’
    255      Insert the selected candidate (‘company-complete-selection’).
    256 
    257 ‘TAB’
    258 ‘<tab>’
    259      Insert the common part of all the candidates
    260      (‘company-complete-common’).
    261 
    262 ‘C-g’
    263 ‘<ESC ESC ESC>’
    264      Cancel _company-mode_ activity (‘company-abort’).
    265 
    266 ‘C-h’
    267 ‘<F1>’
    268      Display a buffer with the documentation for the selected candidate
    269      (‘company-show-doc-buffer’).  With a prefix argument (‘C-u C-h’,
    270      ‘C-u <F1>’), this command toggles between temporary showing the
    271      documentation and keeping the documentation buffer up-to-date
    272      whenever the selection changes.
    273 
    274 ‘C-w’
    275      Display a buffer with the definition of the selected candidate
    276      (‘company-show-location’).
    277 
    278 The full list of the default key bindings is stored in the variables
    279 ‘company-active-map’ and ‘company-search-map’ (1).
    280 
    281 Moreover, Company is bundled with a number of convenience commands that
    282 do not have default key bindings defined.  The following examples
    283 illustrate how to assign key bindings to such commands.
    284 
    285      (global-set-key (kbd "<tab>") #'company-indent-or-complete-common)
    286 
    287      (with-eval-after-load 'company
    288        (define-key company-active-map (kbd "M-/") #'company-complete))
    289 
    290      (with-eval-after-load 'company
    291        (define-key company-active-map
    292                    (kbd "TAB")
    293                    #'company-complete-common-or-cycle)
    294        (define-key company-active-map
    295                    (kbd "<backtab>")
    296                    (lambda ()
    297                      (interactive)
    298                      (company-complete-common-or-cycle -1))))
    299 
    300 In the same manner, an additional key can be assigned to a command or a
    301 command can be unbound from a key.  For instance:
    302 
    303      (with-eval-after-load 'company
    304        (define-key company-active-map (kbd "M-.") #'company-show-location)
    305        (define-key company-active-map (kbd "RET") nil))
    306 
    307    ---------- Footnotes ----------
    308 
    309    (1) For a more user-friendly output of the pre-defined key bindings,
    310 utilize ‘M-x describe-keymap <RET> company-active-map’ or
    311 ‘C-h f <RET> company-mode’.
    312 
    313 
    314 File: docv3QUJv.info,  Node: Customization,  Next: Frontends,  Prev: Getting Started,  Up: Top
    315 
    316 3 Customization
    317 ***************
    318 
    319 Emacs provides two equally acceptable ways for user preferences
    320 configuration: via customization interface (for more details, *note
    321 (emacs)Easy Customization::) and a configuration file (*note (emacs)Init
    322 File::).  Naturally, Company can be configured by both of these
    323 approaches.
    324 
    325 * Menu:
    326 
    327 * Customization Interface::
    328 * Configuration File::
    329 
    330 
    331 File: docv3QUJv.info,  Node: Customization Interface,  Next: Configuration File,  Up: Customization
    332 
    333 3.1 Customization Interface
    334 ===========================
    335 
    336 In order to employ the customization interface, run
    337 ‘M-x customize-group <RET> company’.
    338 
    339 This interface outputs all the options available for user customization,
    340 so you may find it beneficial to review this list even if you are going
    341 to configure Company with the configuration file.
    342 
    343 For instructions on how to change the settings, *note (emacs)Changing a
    344 Variable::.
    345 
    346 
    347 File: docv3QUJv.info,  Node: Configuration File,  Prev: Customization Interface,  Up: Customization
    348 
    349 3.2 Configuration File
    350 ======================
    351 
    352 Company is a customization-rich package.  This section lists some of the
    353 core settings that influence the overall behavior of the _company-mode_.
    354 
    355  -- User Option: company-minimum-prefix-length
    356      This is one of the values (together with ‘company-idle-delay’),
    357      based on which Company auto-stars looking up completion candidates.
    358      This option configures how many characters have to be typed in by a
    359      user before candidates start to be collected and displayed.  An
    360      often choice nowadays is to configure this option to a lower number
    361      than the default value of ‘3’.
    362 
    363  -- User Option: company-idle-delay
    364      This is the second of the options that configure Company’s
    365      auto-start behavior (together with
    366      ‘company-minimum-prefix-length’).  The value of this option defines
    367      how fast Company is going to react to the typed input, such that
    368      setting ‘company-idle-delay’ to ‘0’ makes Company react
    369      immediately, ‘nil’ disables auto-starting, and a larger value
    370      postpones completion auto-start for that number of seconds.  For an
    371      even fancier setup, set this option value to a predicate function,
    372      as shown in the following example:
    373 
    374           (setq company-idle-delay
    375                 (lambda () (if (company-in-string-or-comment) nil 0.3)))
    376 
    377  -- User Option: company-global-modes
    378      This option allows to specify in which major modes _company-mode_
    379      can be enabled by ‘(global-company-mode)’.  *Note Initial Setup::.
    380      The default value of ‘t’ enables Company in all major modes.
    381      Setting ‘company-global-modes’ to ‘nil’ equal in action to toggling
    382      off _global-company-mode_.  Providing a list of major modes results
    383      in having _company-mode_ enabled in the listed modes only.  For the
    384      opposite result, provide a list of major modes with ‘not’ being the
    385      first element of the list, as shown in the following example:
    386 
    387           (setq company-global-modes '(not erc-mode message-mode eshell-mode))
    388 
    389  -- User Option: company-selection-wrap-around
    390      Enable this option to loop (cycle) the candidates’ selection: after
    391      selecting the last candidate on the list, a command to select the
    392      next candidate does so with the first candidate.  By default, this
    393      option is disabled, which means the selection of the next candidate
    394      stops on the last item.  The selection of the previous candidate is
    395      influenced by this option similarly.
    396 
    397  -- User Option: company-require-match
    398      To allow typing in characters that don’t match the candidates, set
    399      the value of this option to ‘nil’.  For an opposite behavior (that
    400      is, to disallow non-matching input), set it to ‘t’.  By default,
    401      Company is configured to require a matching input only if a user
    402      manually enables completion or selects a candidate; by having the
    403      option configured to call the function ‘company-explicit-action-p’.
    404 
    405  -- User Option: company-lighter-base
    406      This user options allows to configure a string indicator of the
    407      enabled _company-mode_ in the mode line.  The default value is
    408      ‘company’.
    409 
    410  -- User Option: company-insertion-on-trigger
    411      One more pair of the user options may instruct Company to complete
    412      with the selected candidate by typing one of the
    413      ‘company-insertion-triggers’.  The user option
    414      ‘company-insertion-on-trigger’ can be enabled or disabled by
    415      setting its value to one of: ‘nil’, ‘t’, or a predicate function
    416      name.  *note Predicate: (eintr)Wrong Type of Argument.
    417 
    418  -- User Option: company-insertion-triggers
    419      This option has an effect only when ‘company-insertion-on-trigger’
    420      is enabled.  The value can be one of: a string of characters, a
    421      list of syntax description characters (*note (elisp)Syntax Class
    422      Table::), or a predicate function.  By default, this user option is
    423      set to the list of the syntax characters: ‘(?\ ?\) ?.)’, which
    424      translates to the whitespaces, close parenthesis, and punctuation.
    425      It is safe to configure the value to a character that can
    426      potentially be part of a valid completion; in this case, Company
    427      does not treat such characters as triggers.
    428 
    429 Hooks
    430 -----
    431 
    432 Company exposes the following life-cycle hooks:
    433 
    434  -- User Option: company-completion-started-hook
    435 
    436  -- User Option: company-completion-cancelled-hook
    437 
    438  -- User Option: company-completion-finished-hook
    439 
    440  -- User Option: company-after-completion-hook
    441 
    442 
    443 File: docv3QUJv.info,  Node: Frontends,  Next: Backends,  Prev: Customization,  Up: Top
    444 
    445 4 Frontends
    446 ***********
    447 
    448 Company is packaged with several frontends and provides a predefined set
    449 of enabled frontends.  A list of the enabled frontends can be changed by
    450 configuring the user option ‘company-frontends’.
    451 
    452 Each frontend is simply a function that receives a command and acts
    453 accordingly to it: outputs candidates, hides its output, refreshes
    454 displayed data, and so on.
    455 
    456 All of the Company frontends can be categorized by the type of the
    457 output into the three groups: “tooltip-”, “preview-”, and “echo-”
    458 frontends.  We overview these groups in the first sections of this
    459 chapter.  The sections that follow are dedicated to the ways the
    460 displayed candidates can be searched, filtered, and quick-accessed.
    461 
    462 * Menu:
    463 
    464 * Tooltip Frontends::
    465 * Preview Frontends::
    466 * Echo Frontends::
    467 * Candidates Search::
    468 * Filter Candidates::
    469 * Quick Access a Candidate::
    470 
    471 
    472 File: docv3QUJv.info,  Node: Tooltip Frontends,  Next: Preview Frontends,  Up: Frontends
    473 
    474 4.1 Tooltip Frontends
    475 =====================
    476 
    477 This group of frontends displays completion candidates in an overlayed
    478 tooltip (aka pop-up).  Company provides three _tooltip frontends_,
    479 listed below.
    480 
    481  -- Function: company-pseudo-tooltip-unless-just-one-frontend
    482      This is one of the default frontends.  It starts displaying a
    483      tooltip only if more than one completion candidate is available,
    484      which nicely combines — and it is done so by default — with
    485      ‘company-preview-if-just-one-frontend’, *note Preview Frontends::.
    486 
    487  -- Function: company-pseudo-tooltip-frontend
    488      This frontend outputs a tooltip for any number of completion
    489      candidates.
    490 
    491  -- Function: company-pseudo-tooltip-unless-just-one-frontend-with-delay
    492      This is a peculiar frontend, that displays a tooltip only if more
    493      than one candidate is available, and only after a delay.  The delay
    494      can be configured with the user option
    495      ‘company-tooltip-idle-delay’.  A typical use case for plugging in
    496      this frontend would be displaying a tooltip only on a manual
    497      request (when needed), as shown in the following example:
    498 
    499           (setq company-idle-delay 0
    500                 company-tooltip-idle-delay 10
    501                 company-require-match nil
    502                 company-frontends
    503                 '(company-pseudo-tooltip-unless-just-one-frontend-with-delay
    504                   company-preview-frontend
    505                   company-echo-metadata-frontend)
    506                 company-backends '(company-capf))
    507 
    508           (global-set-key (kbd "<tab>")
    509                           (lambda ()
    510                             (interactive)
    511                             (let ((company-tooltip-idle-delay 0.0))
    512                               (company-complete)
    513                               (and company-candidates
    514                                    (company-call-frontends 'post-command)))))
    515 
    516 User Options
    517 ------------
    518 
    519 To change the _tooltip frontends_ configuration, adjust the following
    520 user options.
    521 
    522  -- User Option: company-tooltip-align-annotations
    523      An “annotation” is a string that carries additional information
    524      about a candidate; such as a data type, function arguments, or
    525      whatever a backend appoints to be a valuable piece of information
    526      about a candidate.  By default, the annotations are shown right
    527      beside the candidates.  Setting the option value to ‘t’ aligns
    528      annotations to the right side of the tooltip.
    529 
    530           (setq company-tooltip-align-annotations t)
    531 
    532          
    533 
    534  -- User Option: company-tooltip-annotation-padding
    535      Adds left padding to the candidates’ annotations.  It is disabled
    536      by default.  If ‘company-tooltip-align-annotations’ is enabled,
    537      ‘company-tooltip-annotation-padding’ defines the minimum spacing
    538      between a candidate and annotation, with the default value of 1.
    539 
    540           (setq company-tooltip-annotation-padding 1)
    541 
    542  -- User Option: company-tooltip-limit
    543      Controls the maximum number of the candidates shown simultaneously
    544      in the tooltip (the default value is ‘10’).  When the number of the
    545      available candidates is larger than this option’s value, Company
    546      paginates the results.
    547 
    548           (setq company-tooltip-limit 4)
    549 
    550             
    551 
    552  -- User Option: company-tooltip-offset-display
    553      Use this option to choose in which way to output paginated results.
    554      The default value is ‘scrollbar’.  Another supported value is
    555      ‘lines’; choose it to show the quantity of the candidates not
    556      displayed by the current tooltip page.
    557 
    558           (setq company-tooltip-offset-display 'lines)
    559 
    560         
    561 
    562  -- User Option: company-tooltip-minimum
    563      This user option acts only when a tooltip is shown close to the
    564      bottom of a window.  It guarantees visibility of this number of
    565      completion candidates below point.  When the number of lines
    566      between point and the bottom of a window is less than
    567      ‘company-tooltip-minimum’ value, the tooltip is displayed above
    568      point.
    569 
    570           (setq company-tooltip-minimum 4)
    571 
    572         
    573 
    574 
    575         
    576 
    577  -- User Option: company-tooltip-flip-when-above
    578      This is one of the fancy features Company has to suggest.  When
    579      this setting is enabled, no matter if a tooltip is shown above or
    580      below point, the candidates are always listed starting near point.
    581      (Putting it differently, the candidates are mirrored horizontally
    582      if a tooltip changes its position, instead of being commonly listed
    583      top-to-bottom.)
    584 
    585           (setq company-tooltip-flip-when-above t)
    586 
    587              
    588 
    589  -- User Option: company-tooltip-minimum-width
    590      Sets the minimum width of a tooltip, excluding the margins and the
    591      scroll bar.  Changing this value especially makes sense if a user
    592      navigates between tooltip pages.  Keeping this value at the default
    593      ‘0’ allows Company to always adapt the width of the tooltip to the
    594      longest shown candidate.  Enlarging ‘company-tooltip-minimum-width’
    595      prevents possible significant shifts in the width of the tooltip
    596      when navigating to the next/previous tooltip page.  (For an
    597      alternate solution, see ‘company-tooltip-width-grow-only’.)
    598 
    599  -- User Option: company-tooltip-width-grow-only
    600      This is another way to restrict auto-adaptation of the tooltip
    601      width (another is by adjusting ‘company-tooltip-minimum-width’
    602      value) when navigating between the tooltip pages.
    603 
    604  -- User Option: company-tooltip-maximum-width
    605      This user option controls the maximum width of the tooltip inner
    606      area.  By default, its value is pseudo-limitless, potentially
    607      permitting the output of extremely long candidates.  But if long
    608      lines become an issue, set this option to a smaller number, such as
    609      ‘60’ or ‘70’.
    610 
    611  -- User Option: company-tooltip-margin
    612      Controls the width of the “margin” on the sides of the tooltip
    613      inner area.  If ‘company-format-margin-function’ is set,
    614      ‘company-tooltip-margin’ defines only the right margin.
    615 
    616           (setq company-tooltip-margin 3)
    617 
    618             
    619 
    620 Candidates Icons
    621 ----------------
    622 
    623 An “icon” is an image or a text that represents a candidate’s kind; it
    624 is displayed in front of a candidate.  The term “kind” here stands for a
    625 high-level category a candidate fits into.  (Such as ‘array’,
    626 ‘function’, ‘file’, ‘string’, ‘color’, etc.  For an extended list of the
    627 possible _kinds_, see the user option ‘company-text-icons-mapping’ or
    628 the variable ‘company-vscode-icons-mapping’.)
    629 
    630  -- User Option: company-format-margin-function
    631      Allows setting a function to format the left margin of a tooltip
    632      inner area; namely, to output candidate’s _icons_.  The predefined
    633      formatting functions are listed below.  A user may also set this
    634      option to a custom function.  To disable left margin formatting,
    635      set the value of the option to ‘nil’ (this way control over the
    636      size of the left margin returns to the user option
    637      ‘company-tooltip-margin’).
    638 
    639  -- Function: company-vscode-dark-icons-margin
    640  -- Function: company-vscode-light-icons-margin
    641      These functions utilize VSCode dark and light theme icon sets (1).
    642      The related two user options are ‘company-icon-size’ and
    643      ‘company-icon-margin’.
    644 
    645          
    646 
    647  -- Function: company-text-icons-margin
    648      This function produces letters and symbols formatted according to
    649      the ‘company-text-icons-format’.  The rest of the user options
    650      affecting this function behavior are listed below.
    651 
    652           
    653 
    654  -- Function: company-dot-icons-margin
    655      This function produces a colored Unicode symbol of a circle
    656      formatted according to the ‘company-dot-icons-format’.  Other user
    657      options that affect the resulting output are listed below.
    658 
    659           
    660 
    661 The following user options influence appearance of the _text_ and _dot_
    662 _icons_.
    663 
    664  -- User Option: company-text-icons-mapping
    665      Lists candidates’ _kinds_ with their corresponding _icons_
    666      configurations.
    667 
    668  -- User Option: company-text-face-extra-attributes
    669      A list of face attributes to be applied to the _icons_.
    670 
    671           (setq company-text-face-extra-attributes
    672                 '(:weight bold :slant italic))
    673 
    674           
    675 
    676  -- User Option: company-text-icons-add-background
    677      If this option is enabled, when an _icon_ doesn’t have a background
    678      configured by ‘company-text-icons-mapping’, then a generated
    679      background is applied.
    680 
    681           (setq company-text-icons-add-background t)
    682 
    683            
    684 
    685  -- Function: company-detect-icons-margin
    686      This is the default margin formatting function, that applies one of
    687      the ‘company-vscode-*-icons-margin’ functions if ‘vscode’ icons set
    688      is supported; otherwise applies a ‘company-text-icons-margin’
    689      function.
    690 
    691 Faces
    692 -----
    693 
    694 Out-of-the-box Company defines and configures distinguished faces (*note
    695 (emacs)Faces::) for light and dark themes.  Moreover, some of the
    696 built-in and third-party themes fine-tune Company to fit their palettes.
    697 That is why there’s often no real need to make such adjustments on a
    698 user side.  However, this chapter presents some hints on where to start
    699 customizing Company interface.
    700 
    701 Namely, the look of a tooltip is controlled by the ‘company-tooltip*’
    702 named faces.
    703 
    704 The following example hints how a user may approach tooltip faces
    705 customization:
    706 
    707      (custom-set-faces
    708       '(company-tooltip
    709         ((t (:background "ivory" :foreground "MistyRose3"))))
    710       '(company-tooltip-selection
    711         ((t (:background "LemonChiffon1" :foreground "MistyRose4"))))
    712       '(company-tooltip-common ((t (:weight bold :foreground "pink1"))))
    713       '(company-scrollbar-fg ((t (:background "ivory3"))))
    714       '(company-scrollbar-bg ((t (:background "ivory2"))))
    715       '(company-tooltip-annotation ((t (:foreground "MistyRose2")))))
    716 
    717          
    718 
    719    ---------- Footnotes ----------
    720 
    721    (1) SVG images support has to be enabled in Emacs for these icons set
    722 to be used.  The supported images types can be checked with ‘C-h v
    723 image-types’.  Before compiling Emacs, make sure ‘librsvg’ is installed
    724 on your system.
    725 
    726 
    727 File: docv3QUJv.info,  Node: Preview Frontends,  Next: Echo Frontends,  Prev: Tooltip Frontends,  Up: Frontends
    728 
    729 4.2 Preview Frontends
    730 =====================
    731 
    732 Frontends in this group output a completion candidate or a common part
    733 of the candidates temporarily inline, as if a word had already been
    734 completed (1).
    735 
    736  -- Function: company-preview-if-just-one-frontend
    737      This is one of the frontends enabled by default.  This frontend
    738      outputs a preview if only one completion candidate is available; it
    739      is a good suit to be combined with
    740      ‘company-pseudo-tooltip-unless-just-one-frontend’, *note Tooltip
    741      Frontends::.
    742 
    743  -- Function: company-preview-frontend
    744      This frontend outputs the first of the available completion
    745      candidates inline for a preview.
    746 
    747  -- Function: company-preview-common-frontend
    748      As the name of this frontend suggests, it outputs for a preview
    749      only a common part of the candidates.
    750 
    751 The look of the preview is controlled by the following faces:
    752 ‘company-preview’, ‘company-preview-common’, and
    753 ‘company-preview-search’.
    754 
    755             
    756 
    757 
    758              
    759 
    760    ---------- Footnotes ----------
    761 
    762    (1) The candidates retrieved according to ‘non-prefix’ matches (*note
    763 Terminology::) may be shown in full after point.
    764 
    765 
    766 File: docv3QUJv.info,  Node: Echo Frontends,  Next: Candidates Search,  Prev: Preview Frontends,  Up: Frontends
    767 
    768 4.3 Echo Frontends
    769 ==================
    770 
    771 The frontends listed in this section display information in the Emacs’s
    772 echo area, *note (emacs)Echo Area::.
    773 
    774  -- Function: company-echo-metadata-frontend
    775      This frontend is a part of the predefined frontends set.  Its
    776      responsibility is to output a short documentation string for a
    777      completion candidate in the echo area.
    778 
    779               
    780 
    781 
    782 The last pair of the built-in frontends isn’t that commonly used and not
    783 as full-featured as the previously reviewed _tooltip-_ and _preview-_
    784 frontends, but still, feel free to play with them and have some fun!
    785 
    786  -- Function: company-echo-frontend
    787      This frontend outputs all the available completion candidates in
    788      the echo area.
    789 
    790                  
    791 
    792  -- Function: company-echo-strip-common-frontend
    793      It acts similarly to the previous frontend but outputs a common
    794      part of the candidates once for all of them.
    795 
    796               
    797 
    798  -- User Option: company-echo-truncate-lines
    799      This is the only _echo frontends_ targeted setting.  When enabled,
    800      the output is truncated to fit the echo area.  This setting is set
    801      to ‘t’ by default.
    802 
    803 To apply visual changes to the output of these frontends, configure the
    804 faces ‘company-echo’ and ‘company-echo-common’.
    805 
    806 
    807 File: docv3QUJv.info,  Node: Candidates Search,  Next: Filter Candidates,  Prev: Echo Frontends,  Up: Frontends
    808 
    809 4.4 Candidates Search
    810 =====================
    811 
    812 By default, when _company-mode_ is in action, a key binding ‘C-s’ starts
    813 looking for matches to additionally typed characters among the displayed
    814 candidates.  When a search is initiated, an indicator
    815 ‘Search: CHARACTERS’ is shown in the Emacs’s mode line.
    816 
    817 To quit the search mode, hit ‘C-g’.
    818 
    819  -- User Option: company-search-regexp-function
    820      The value of this user option must be a function that interprets
    821      the search input.  By default it is set to the function
    822      ‘regexp-quote’, with looks for an exact match.  Company defines
    823      several more functions suitable for this option.  They are listed
    824      below.
    825 
    826  -- Function: company-search-words-regexp
    827      Searches for words separated with spaces in the given order.
    828 
    829  -- Function: company-search-words-in-any-order-regexp
    830      Searches for words separated with spaces in any order.
    831 
    832  -- Function: company-search-flex-regexp
    833      Searches for characters in the given order, with anything in
    834      between.
    835 
    836 Search matches are distinguished by the ‘company-tooltip-search’ and
    837 ‘company-tooltip-search-selection’ faces.
    838 
    839             
    840 
    841 
    842 File: docv3QUJv.info,  Node: Filter Candidates,  Next: Quick Access a Candidate,  Prev: Candidates Search,  Up: Frontends
    843 
    844 4.5 Filter Candidates
    845 =====================
    846 
    847 Candidates filtering is started by typing the default key binding
    848 ‘C-M-s’.  Filtering acts on a par with the search (*note Candidates
    849 Search::), indicating its activation by the text ‘Filter: CHARACTERS’ in
    850 the mode line and influencing the displayed candidates.  The difference
    851 is that the filtering, as its name suggests, keeps displaying only the
    852 matching candidates (in addition to distinguishing the matches with a
    853 face).
    854 
    855 To quit the filtering, hit ‘C-g’.  To toggle between search and filter
    856 states, use key binding ‘C-o’.
    857 
    858             
    859 
    860 
    861 File: docv3QUJv.info,  Node: Quick Access a Candidate,  Prev: Filter Candidates,  Up: Frontends
    862 
    863 4.6 Quick Access a Candidate
    864 ============================
    865 
    866 Company provides a way to choose a candidate for completion without
    867 having to navigate to that candidate: by hitting one of the quick-access
    868 keys.  By default, quick-access key bindings utilize a modifier <META>
    869 and one of the digits, such that pressing ‘M-1’ completes with the first
    870 candidate on the list and ‘M-0’ with the tenth candidate.
    871 
    872 If ‘company-show-quick-access’ is enabled, _tooltip-_ and _echo-_
    873 frontends show quick-access hints.
    874 
    875      (setq company-show-quick-access 'left)
    876 
    877          
    878 
    879 
    880                
    881 
    882 
    883             
    884 
    885 To customize the key bindings, either do it via Customization Interface
    886 (*note Customization Interface::) or use the following approach:
    887 
    888      (custom-set-variables
    889       '(company-quick-access-keys '("a" "o" "e" "u" "i"))
    890       '(company-quick-access-modifier 'super))
    891 
    892 A modifier should be one of ‘meta’, ‘super’, ‘hyper’, ‘ control’.
    893 
    894 The following example applies a bit of customization and demonstrates
    895 how to change quick-access hints faces.
    896 
    897      (setq company-show-quick-access t)
    898 
    899      (custom-set-faces
    900       '(company-tooltip-quick-access ((t (:foreground "pink1"))))
    901       '(company-tooltip-quick-access-selection
    902         ((t (:foreground "pink1" :slant italic)))))
    903 
    904         
    905 
    906 
    907 File: docv3QUJv.info,  Node: Backends,  Next: Troubleshooting,  Prev: Frontends,  Up: Top
    908 
    909 5 Backends
    910 **********
    911 
    912 We can metaphorically say that each backend is like an engine.  (The
    913 reality is even better since backends are just functions.)  Fueling such
    914 an engine with a command causes the production of material for Company
    915 to move further on.  Typically, moving on means outputting that material
    916 to a user via one or several configured frontends, *note Frontends::.
    917 
    918 Just like Company provides a preconfigured list of the enabled
    919 frontends, it also defines a list of the backends to rely on by default.
    920 This list is stored in the user option ‘company-backends’.  The
    921 docstring of this variable has been a source of valuable information for
    922 years.  That’s why we’re going to stick to a tradition and suggest
    923 reading the output of ‘C-h v company-backends’ for insightful details
    924 about backends.  Nevertheless, the fundamental concepts are described in
    925 this user manual too.
    926 
    927 * Menu:
    928 
    929 * Backends Usage Basics::
    930 * Grouped Backends::
    931 * Package Backends::
    932 * Candidates Post-Processing::
    933 
    934 
    935 File: docv3QUJv.info,  Node: Backends Usage Basics,  Next: Grouped Backends,  Up: Backends
    936 
    937 5.1 Backends Usage Basics
    938 =========================
    939 
    940 One of the significant concepts to understand about Company is that the
    941 package relies on one backend at a time (1).  The backends are invoked
    942 one by one, in the sequential order of the items on the
    943 ‘company-backends’ list.
    944 
    945 The name of the currently active backend is shown in the mode line and
    946 in the output of the command ‘M-x company-diag’.
    947 
    948 In most cases (mainly to exclude false-positive results), the next
    949 backend is not invoked automatically.  For the purpose of invoking the
    950 next backend, use the command ‘company-other-backend’: either by calling
    951 it with ‘M-x’ or by binding the command to the keys of your choice, such
    952 as:
    953 
    954      (global-set-key (kbd "C-c C-/") #'company-other-backend)
    955 
    956 It is also possible to specifically start a backend with the command
    957 ‘M-x company-begin-backend’ or by calling a backend by its name, for
    958 instance: ‘M-x company-capf’.  As usual for Emacs, such backends calls
    959 can be assigned to key bindings, for example:
    960 
    961      (global-set-key (kbd "C-c y") 'company-yasnippet)
    962 
    963    ---------- Footnotes ----------
    964 
    965    (1) The grouped backends act as one complex backend.  *Note Grouped
    966 Backends::.
    967 
    968 
    969 File: docv3QUJv.info,  Node: Grouped Backends,  Next: Package Backends,  Prev: Backends Usage Basics,  Up: Backends
    970 
    971 5.2 Grouped Backends
    972 ====================
    973 
    974 In many cases, it can be desirable to receive candidates from several
    975 backends simultaneously.  This can be achieved by configuring “grouped
    976 backends”: a sub-list of backends in the ‘company-backends’ list, that
    977 is handled specifically by Company.
    978 
    979 The most important part of this handling is the merge of the completion
    980 candidates from the grouped backends.  (But only from the backends that
    981 return the same _prefix_ value, see ‘C-h v company-backends’ for more
    982 details.)
    983 
    984 To keep the candidates organized in accordance with the grouped backends
    985 order, add the keyword ‘:separate’ to the list of the grouped backends.
    986 The following example illustrates this.
    987 
    988      (defun my-text-mode-hook ()
    989        (setq-local company-backends
    990                    '((company-dabbrev company-ispell :separate)
    991                      company-files)))
    992 
    993      (add-hook 'text-mode-hook #'my-text-mode-hook)
    994 
    995 Another keyword ‘:with’ helps to make sure the results from major/minor
    996 mode agnostic backends (such as _company-yasnippet_,
    997 _company-dabbrev-code_) are returned without preventing results from
    998 context-aware backends (such as _company-capf_ or _company-clang_).  For
    999 this feature to work, put backends dependent on a mode at the beginning
   1000 of the grouped backends list, then put a keyword ‘:with’, and only then
   1001 put context agnostic backend(s), as shown in the following concise
   1002 example:
   1003 
   1004      (setq company-backends '((company-capf :with company-yasnippet)))
   1005 
   1006 
   1007 File: docv3QUJv.info,  Node: Package Backends,  Next: Candidates Post-Processing,  Prev: Grouped Backends,  Up: Backends
   1008 
   1009 5.3 Package Backends
   1010 ====================
   1011 
   1012 The following sections give a short overview of the commonly used
   1013 backends bundled with Company.  Each section is devoted to one of the
   1014 roughly outlined groups of the backends.
   1015 
   1016 Some of the backends expose user options for customization; a few of
   1017 these options are introduced below.  For those who would like to fetch
   1018 the full list of a backend’s user options, we suggest doing one of the
   1019 following:
   1020 
   1021    • Execute command ‘M-x customize-group <RET> <backend-name>’.
   1022 
   1023    • Open the source file of the backend and run
   1024      ‘M-x occur <RET> ^(defcustom’.
   1025 
   1026         − Optionally, search for the matches with
   1027           ‘M-x isearch <RET> (defcustom’.
   1028 
   1029 * Menu:
   1030 
   1031 * Code Completion::
   1032 * Text Completion::
   1033 * File Name Completion::
   1034 * Template Expansion::
   1035 
   1036 
   1037 File: docv3QUJv.info,  Node: Code Completion,  Next: Text Completion,  Up: Package Backends
   1038 
   1039 5.3.1 Code Completion
   1040 ---------------------
   1041 
   1042  -- Function: company-capf
   1043      In the Emacs’s world, the current tendency is to have the
   1044      completion logic provided by ‘completion-at-point-functions’ (CAPF)
   1045      implementations.  [Among the other things, this is what the popular
   1046      packages that support language server protocol (LSP) also rely on.]
   1047 
   1048      Since _company-capf_ works as a bridge to the standard CAPF
   1049      facility, it is probably the most often used and recommended
   1050      backend nowadays, including for Emacs Lisp coding.
   1051 
   1052      Just to illustrate, the following minimal backends setup
   1053 
   1054           (setq company-backends '((company-capf company-dabbrev-code)))
   1055 
   1056      might cover a large number of basic use cases, especially so in
   1057      major modes that have CAPF support implemented.
   1058 
   1059      For more details on CAPF, *note (elisp)Completion in Buffers::.
   1060 
   1061  -- Function: company-dabbrev-code
   1062      This backend works similarly to the built-in Emacs package
   1063      _dabbrev_, searching for completion candidates inside the contents
   1064      of the open buffer(s).  Internally, its based on the backend
   1065      _company-dabbrev_ (*note Text Completion::).
   1066 
   1067  -- Function: company-keywords
   1068      This backend provides completions for many of the widely spread
   1069      programming languages _keywords_: words bearing specific meaning in
   1070      a language.
   1071 
   1072  -- Function: company-clang
   1073      As the name suggests, use this backend to get completions from
   1074      _Clang_ compiler; that is, for the languages in the _C_ language
   1075      family: _C_, _C++_, _Objective-C_.
   1076 
   1077  -- Function: company-semantic
   1078      This backend relies on a built-in Emacs package that provides
   1079      language-aware editing commands based on source code parsers, *note
   1080      (emacs)Semantic::.  Having enabled _semantic-mode_ makes it to be
   1081      used by the CAPF mechanism (*note (emacs)Symbol Completion::),
   1082      hence a user may consider enabling _company-capf_ backend instead.
   1083 
   1084  -- Function: company-etags
   1085      This backend works on top of a built-in Emacs package _etags_,
   1086      *note (emacs)Tags Tables::.  Similarly to aforementioned _Semantic_
   1087      usage, tags-based completions now are a part of the Emacs’ CAPF
   1088      facility, therefore a user may consider switching to _company-capf_
   1089      backend.
   1090 
   1091 
   1092 File: docv3QUJv.info,  Node: Text Completion,  Next: File Name Completion,  Prev: Code Completion,  Up: Package Backends
   1093 
   1094 5.3.2 Text Completion
   1095 ---------------------
   1096 
   1097  -- Function: company-dabbrev
   1098      This backend works similarly to the built-in Emacs package
   1099      _dabbrev_, searching for completion candidates inside the contents
   1100      of the open buffer(s).  It is one of the often used backends, and
   1101      it has several interesting options for configuration.  Let’s review
   1102      a few of them.
   1103 
   1104       -- User Option: company-dabbrev-minimum-length
   1105           This option sets the minimum length of a completion candidate
   1106           to collect from the text.  The default value of ‘4’ is
   1107           intended to prevent potential performance issues.  But in many
   1108           scenarios, it may be acceptable to lower this value.  Note
   1109           that this option also affects the behavior of the
   1110           _company-dabbrev-code_ backend.
   1111 
   1112                (setq company-dabbrev-minimum-length 2)
   1113 
   1114       -- User Option: company-dabbrev-other-buffers
   1115           By default, _company-dabbrev_ collects completion candidates
   1116           from all not ignored buffers (see more on that below).  This
   1117           behavior can be changed to collecting candidates from the
   1118           current buffer only (by setting the value to ‘nil’) or from
   1119           the buffers with the same major mode:
   1120 
   1121                (setq company-dabbrev-other-buffers t)
   1122 
   1123       -- User Option: company-dabbrev-ignore-buffers
   1124           The value of this option should be a regexp or a predicate
   1125           function that can be used to match a buffer name.  The matched
   1126           buffers are omitted from the search for completion candidates.
   1127 
   1128      The last two options described here relate to handling uppercase
   1129      and lowercase letters in completion candidates.  The illustrative
   1130      examples given below can be reproduced in the ‘*scratch*’ buffer,
   1131      with the word ‘Enjoy’ typed in, and with this initial setup:
   1132 
   1133           (setq-local company-backends '(company-dabbrev)
   1134                       company-dabbrev-other-buffers nil
   1135                       company-dabbrev-ignore-case nil
   1136                       company-dabbrev-downcase nil)
   1137 
   1138       -- User Option: company-dabbrev-ignore-case
   1139           This user option controls whether the case is ignored when
   1140           collecting completion candidates.  When the option is set to
   1141           ‘nil’, ‘Enjoy’ is suggested as a completion candidate for the
   1142           typed ‘Enj’ letters, but not for ‘enj’.  When the option is
   1143           set to ‘t’, ‘Enjoy’ is suggested as a candidate for both ‘Enj’
   1144           and ‘enj’ input; note that ‘enj’ prefix is “overwritten” by
   1145           completing with the ‘Enjoy’ candidate.  The third, default,
   1146           type of behavior solves this issue, keeping the case of the
   1147           typed prefix (and still collecting candidates
   1148           case-insensitively):
   1149 
   1150                (setq company-dabbrev-ignore-case 'keep-prefix)
   1151 
   1152           Now we can type ‘enj’, complete it with the suggested ‘Enjoy’,
   1153           and _enjoy_ the result.
   1154 
   1155       -- User Option: company-dabbrev-downcase
   1156           This user option controls whether completion candidates are
   1157           down-cased before their display.  When the option is set to
   1158           ‘nil’, no transformation is performed; in the environment
   1159           described above, typing ‘Enj’ results in the candidate ‘Enjoy’
   1160           being suggested.  When the option is set to ‘t’, the
   1161           down-cased candidate ‘enjoy’ is suggested.  By default, this
   1162           option is set to ‘case-replace’, meaning taking a value of the
   1163           Emacs’s variable ‘case-replace’ (‘t’ is the current default).
   1164 
   1165 
   1166  -- Function: company-ispell
   1167      This backend returns completion candidates collected by _Ispell_, a
   1168      built-in Emacs package that performs spell-checking.  *Note
   1169      Checking and Correcting Spelling: (emacs)Spelling.  Note that
   1170      _Ispell_ uses only one dictionary at a time (combining several
   1171      dictionaries into one file is an accepted practice).  By default,
   1172      _company-ispell_ suggests candidates from a dictionary specified by
   1173      the Emacs’s setting ‘ispell-complete-word-dict’.
   1174 
   1175       -- User Option: company-ispell-dictionary
   1176           Optionally, set a file path for _company-ispell_ to use
   1177           another dictionary.
   1178 
   1179 
   1180 File: docv3QUJv.info,  Node: File Name Completion,  Next: Template Expansion,  Prev: Text Completion,  Up: Package Backends
   1181 
   1182 5.3.3 File Name Completion
   1183 --------------------------
   1184 
   1185  -- Function: company-files
   1186      This backend can be used to retrieve completion candidates for the
   1187      absolute and relative paths in the directory structure of an
   1188      operating system.  The behavior of the _company-files_ backend can
   1189      be adjusted with the two user options.
   1190 
   1191       -- User Option: company-files-exclusions
   1192           It may be desirable to exclude directories or files from the
   1193           list of suggested completion candidates.  For example,
   1194           someone’s setup might look this way:
   1195 
   1196                (setq company-files-exclusions '(".git/" ".DS_Store"))
   1197 
   1198       -- User Option: company-files-chop-trailing-slash
   1199           This setting is enabled by default, which results in stripping
   1200           off a trailing slash from an inserted directory name.  On
   1201           typing a trailing slash, the process of completion gets
   1202           started again, from inside the just inserted directory.
   1203 
   1204           Setting ‘company-files-chop-trailing-slash’ to ‘nil’ makes
   1205           directory names to be inserted as is, with a trailing slash.
   1206           In this case, the completion process can be continued, for
   1207           example, either by explicitly calling _company-files_ backend
   1208           (*note Backends Usage Basics::) or by starting typing a name
   1209           of a file/directory known to be located under the inserted
   1210           directory.
   1211 
   1212 
   1213 File: docv3QUJv.info,  Node: Template Expansion,  Prev: File Name Completion,  Up: Package Backends
   1214 
   1215 5.3.4 Template Expansion
   1216 ------------------------
   1217 
   1218  -- Function: company-abbrev
   1219      This is a completion backend for a built-in word abbreviation mode
   1220      (*note (emacs)Abbrevs::), that allows completing abbreviations with
   1221      their expansions.
   1222 
   1223  -- Function: company-tempo
   1224      A backend for users of Tempo
   1225      (https://www.lysator.liu.se/~davidk/elisp/), one more built-in
   1226      Emacs package for creating and inserting (expanding) templates.
   1227 
   1228  -- Function: company-yasnippet
   1229      Used as a completion backend for the popular third-party template
   1230      system YASnippet (https://github.com/joaotavora/yasnippet).
   1231 
   1232 
   1233 File: docv3QUJv.info,  Node: Candidates Post-Processing,  Prev: Package Backends,  Up: Backends
   1234 
   1235 5.4 Candidates Post-Processing
   1236 ==============================
   1237 
   1238 A list of completion candidates, supplied by a backend, can be
   1239 additionally manipulated (reorganized, reduced, sorted, etc) before its
   1240 output.  This is done by adding a processing function name to the user
   1241 option ‘company-transformers’ list, for example:
   1242 
   1243      (setq company-transformers '(delete-consecutive-dups
   1244                                   company-sort-by-occurrence))
   1245 
   1246 Company is bundled with several such transformer functions.  They are
   1247 listed below.
   1248 
   1249  -- Function: company-sort-by-occurrence
   1250      Sorts candidates using ‘company-occurrence-weight-function’
   1251      algorithm.
   1252 
   1253  -- User Option: company-occurrence-weight-function
   1254      Can be set to one of ‘company-occurrence-prefer-closest-above’
   1255      (default) or ‘company-occurrence-prefer-any-closest’.  This user
   1256      option defines the behavior of the ‘company-sort-by-occurrence’
   1257      transformer function.
   1258 
   1259  -- Function: company-sort-by-backend-importance
   1260      Sorts candidates as two priority groups, differentiated by the
   1261      keyword ‘:with’ (*note Grouped Backends::).  Backends positioned in
   1262      the backends list before the keyword ‘:with’ are treated as more
   1263      important.
   1264 
   1265  -- Function: company-sort-prefer-same-case-prefix
   1266      Gives preference to the candidates that match the prefix
   1267      case-insensitively.
   1268 
   1269 
   1270 File: docv3QUJv.info,  Node: Troubleshooting,  Next: Index,  Prev: Backends,  Up: Top
   1271 
   1272 6 Troubleshooting
   1273 *****************
   1274 
   1275 If something goes wrong, the first thing we recommend doing is to
   1276 execute command ‘M-x company-diag’ and thoroughly study its output.
   1277 
   1278 This command outputs important details about the internal workings of
   1279 Company at the moment of the ‘company-diag’ command execution, including
   1280 a responsible backend and a list of completion candidates provided by
   1281 it.
   1282 
   1283 Based on the value of the ‘Used backend’ in the output of the command
   1284 ‘M-x company-diag’, these possible actions may follow:
   1285 
   1286    • If the used backend does not belong to the Company package, report
   1287      the issue to the corresponding third-party package maintainer(s).
   1288 
   1289    • If the used backend is ‘company-capf’, then take a look at the line
   1290      starting with ‘Value of c-a-p-f:’.  The issue could have been
   1291      caused by a function listed there.  To identify to which package it
   1292      belongs, type ‘M-x find-function <RET> <function-name> <RET>’.
   1293 
   1294 If the aforementioned steps didn’t help to find the cause of the issue,
   1295 then file a bug report to
   1296 the Company Issue Tracker (https://github.com/company-mode/company-mode/issues),
   1297 attaching the following information:
   1298 
   1299   1. Output of the ‘M-x company-diag’.
   1300 
   1301   2. The exact error message: you can find it in the ‘*Messages*’
   1302      buffer.
   1303 
   1304   3. The steps to reproduce the behavior.  Ideally, if you can, starting
   1305      with a bare Emacs session: ‘emacs -Q’.
   1306 
   1307   4. The backtrace of the error, which you can get by running the
   1308      command: ‘M-x toggle-debug-on-error’ before reproducing the error.
   1309 
   1310 
   1311 File: docv3QUJv.info,  Node: Index,  Prev: Troubleshooting,  Up: Top
   1312 
   1313 Index
   1314 *****
   1315 
   1316 * Menu:
   1317 
   1318 * Key Index::
   1319 * Variable Index::
   1320 * Function Index::
   1321 * Concept Index::
   1322 
   1323 
   1324 File: docv3QUJv.info,  Node: Key Index,  Next: Variable Index,  Up: Index
   1325 
   1326 Key Index
   1327 =========
   1328 
   1329 
   1330 * Menu:
   1331 
   1332 * C-g:                                   Usage Basics.         (line 20)
   1333 * C-g <1>:                               Commands.             (line 30)
   1334 * C-g <2>:                               Candidates Search.    (line 11)
   1335 * C-g <3>:                               Filter Candidates.    (line 14)
   1336 * C-h:                                   Commands.             (line 34)
   1337 * C-M-s:                                 Filter Candidates.    (line  6)
   1338 * C-n:                                   Usage Basics.         (line 12)
   1339 * C-n <1>:                               Commands.             (line 11)
   1340 * C-o:                                   Filter Candidates.    (line 14)
   1341 * C-p:                                   Usage Basics.         (line 12)
   1342 * C-p <1>:                               Commands.             (line 16)
   1343 * C-s:                                   Candidates Search.    (line  6)
   1344 * C-w:                                   Commands.             (line 41)
   1345 * M-<digit>:                             Quick Access a Candidate.
   1346                                                                (line  6)
   1347 * RET:                                   Usage Basics.         (line 15)
   1348 * RET <1>:                               Commands.             (line 21)
   1349 * TAB:                                   Usage Basics.         (line 17)
   1350 * TAB <1>:                               Commands.             (line 25)
   1351 
   1352 
   1353 File: docv3QUJv.info,  Node: Variable Index,  Next: Function Index,  Prev: Key Index,  Up: Index
   1354 
   1355 Variable Index
   1356 ==============
   1357 
   1358 
   1359 * Menu:
   1360 
   1361 * company-after-completion-hook:         Configuration File.  (line  94)
   1362 * company-backends:                      Backends.            (line  12)
   1363 * company-backends <1>:                  Backends Usage Basics.
   1364                                                               (line   6)
   1365 * company-backends <2>:                  Grouped Backends.    (line   6)
   1366 * company-completion-cancelled-hook:     Configuration File.  (line  90)
   1367 * company-completion-finished-hook:      Configuration File.  (line  92)
   1368 * company-completion-started-hook:       Configuration File.  (line  88)
   1369 * company-dabbrev-downcase:              Text Completion.     (line  64)
   1370 * company-dabbrev-ignore-buffers:        Text Completion.     (line  32)
   1371 * company-dabbrev-ignore-case:           Text Completion.     (line  47)
   1372 * company-dabbrev-minimum-length:        Text Completion.     (line  13)
   1373 * company-dabbrev-other-buffers:         Text Completion.     (line  23)
   1374 * company-dot-icons-format:              Tooltip Frontends.   (line 184)
   1375 * company-echo-truncate-lines:           Echo Frontends.      (line  33)
   1376 * company-files-chop-trailing-slash:     File Name Completion.
   1377                                                               (line  19)
   1378 * company-files-exclusions:              File Name Completion.
   1379                                                               (line  12)
   1380 * company-format-margin-function:        Tooltip Frontends.   (line 159)
   1381 * company-frontends:                     Frontends.           (line   6)
   1382 * company-global-modes:                  Configuration File.  (line  31)
   1383 * company-icon-margin:                   Tooltip Frontends.   (line 170)
   1384 * company-icon-size:                     Tooltip Frontends.   (line 170)
   1385 * company-idle-delay:                    Configuration File.  (line  17)
   1386 * company-insertion-on-trigger:          Configuration File.  (line  64)
   1387 * company-insertion-triggers:            Configuration File.  (line  72)
   1388 * company-ispell-dictionary:             Text Completion.     (line  84)
   1389 * company-lighter-base:                  Configuration File.  (line  59)
   1390 * company-minimum-prefix-length:         Configuration File.  (line   9)
   1391 * company-mode:                          Initial Setup.       (line   6)
   1392 * company-occurrence-weight-function:    Candidates Post-Processing.
   1393                                                               (line  21)
   1394 * company-require-match:                 Configuration File.  (line  51)
   1395 * company-search-regexp-function:        Candidates Search.   (line  13)
   1396 * company-selection-wrap-around:         Configuration File.  (line  43)
   1397 * company-show-quick-access:             Quick Access a Candidate.
   1398                                                               (line  12)
   1399 * company-text-face-extra-attributes:    Tooltip Frontends.   (line 197)
   1400 * company-text-icons-add-background:     Tooltip Frontends.   (line 205)
   1401 * company-text-icons-format:             Tooltip Frontends.   (line 177)
   1402 * company-text-icons-mapping:            Tooltip Frontends.   (line 193)
   1403 * company-tooltip-align-annotations:     Tooltip Frontends.   (line  51)
   1404 * company-tooltip-annotation-padding:    Tooltip Frontends.   (line  63)
   1405 * company-tooltip-flip-when-above:       Tooltip Frontends.   (line 106)
   1406 * company-tooltip-idle-delay:            Tooltip Frontends.   (line  21)
   1407 * company-tooltip-limit:                 Tooltip Frontends.   (line  71)
   1408 * company-tooltip-margin:                Tooltip Frontends.   (line 140)
   1409 * company-tooltip-maximum-width:         Tooltip Frontends.   (line 133)
   1410 * company-tooltip-minimum:               Tooltip Frontends.   (line  91)
   1411 * company-tooltip-minimum-width:         Tooltip Frontends.   (line 118)
   1412 * company-tooltip-offset-display:        Tooltip Frontends.   (line  81)
   1413 * company-tooltip-width-grow-only:       Tooltip Frontends.   (line 128)
   1414 * company-transformers:                  Candidates Post-Processing.
   1415                                                               (line   6)
   1416 
   1417 
   1418 File: docv3QUJv.info,  Node: Function Index,  Next: Concept Index,  Prev: Variable Index,  Up: Index
   1419 
   1420 Function Index
   1421 ==============
   1422 
   1423 
   1424 * Menu:
   1425 
   1426 * company-abbrev:                        Template Expansion.  (line   6)
   1427 * company-abort:                         Commands.            (line  30)
   1428 * company-begin-backend:                 Backends Usage Basics.
   1429                                                               (line  22)
   1430 * company-capf:                          Code Completion.     (line   6)
   1431 * company-clang:                         Code Completion.     (line  36)
   1432 * company-complete:                      Usage Basics.        (line  10)
   1433 * company-complete-common:               Commands.            (line  25)
   1434 * company-complete-selection:            Commands.            (line  21)
   1435 * company-dabbrev:                       Text Completion.     (line   6)
   1436 * company-dabbrev-code:                  Code Completion.     (line  25)
   1437 * company-detect-icons-margin:           Tooltip Frontends.   (line 214)
   1438 * company-diag:                          Backends Usage Basics.
   1439                                                               (line  11)
   1440 * company-diag <1>:                      Troubleshooting.     (line   6)
   1441 * company-dot-icons-margin:              Tooltip Frontends.   (line 183)
   1442 * company-echo-frontend:                 Echo Frontends.      (line  21)
   1443 * company-echo-metadata-frontend:        Echo Frontends.      (line   9)
   1444 * company-echo-strip-common-frontend:    Echo Frontends.      (line  27)
   1445 * company-etags:                         Code Completion.     (line  48)
   1446 * company-files:                         File Name Completion.
   1447                                                               (line   6)
   1448 * company-ispell:                        Text Completion.     (line  75)
   1449 * company-keywords:                      Code Completion.     (line  31)
   1450 * company-mode:                          Initial Setup.       (line   6)
   1451 * company-other-backend:                 Backends Usage Basics.
   1452                                                               (line  14)
   1453 * company-preview-common-frontend:       Preview Frontends.   (line  21)
   1454 * company-preview-frontend:              Preview Frontends.   (line  17)
   1455 * company-preview-if-just-one-frontend:  Preview Frontends.   (line  10)
   1456 * company-pseudo-tooltip-frontend:       Tooltip Frontends.   (line  16)
   1457 * company-pseudo-tooltip-unless-just-one-frontend: Tooltip Frontends.
   1458                                                               (line  10)
   1459 * company-pseudo-tooltip-unless-just-one-frontend-with-delay: Tooltip Frontends.
   1460                                                               (line  20)
   1461 * company-search-flex-regexp:            Candidates Search.   (line  26)
   1462 * company-search-words-in-any-order-regexp: Candidates Search.
   1463                                                               (line  23)
   1464 * company-search-words-regexp:           Candidates Search.   (line  20)
   1465 * company-select-next:                   Commands.            (line  11)
   1466 * company-select-next-or-abort:          Commands.            (line  11)
   1467 * company-select-previous:               Commands.            (line  16)
   1468 * company-select-previous-or-abort:      Commands.            (line  16)
   1469 * company-semantic:                      Code Completion.     (line  41)
   1470 * company-show-doc-buffer:               Commands.            (line  34)
   1471 * company-show-location:                 Commands.            (line  41)
   1472 * company-sort-by-backend-importance:    Candidates Post-Processing.
   1473                                                               (line  27)
   1474 * company-sort-by-occurrence:            Candidates Post-Processing.
   1475                                                               (line  17)
   1476 * company-sort-prefer-same-case-prefix:  Candidates Post-Processing.
   1477                                                               (line  33)
   1478 * company-tempo:                         Template Expansion.  (line  11)
   1479 * company-text-icons-margin:             Tooltip Frontends.   (line 176)
   1480 * company-tng-frontend:                  Structure.           (line  26)
   1481 * company-tng-mode:                      Structure.           (line  26)
   1482 * company-vscode-dark-icons-margin:      Tooltip Frontends.   (line 168)
   1483 * company-vscode-light-icons-margin:     Tooltip Frontends.   (line 169)
   1484 * company-yasnippet:                     Template Expansion.  (line  16)
   1485 * global-company-mode:                   Initial Setup.       (line  18)
   1486 
   1487 
   1488 File: docv3QUJv.info,  Node: Concept Index,  Prev: Function Index,  Up: Index
   1489 
   1490 Concept Index
   1491 =============
   1492 
   1493 
   1494 * Menu:
   1495 
   1496 * abbrev:                                Template Expansion.  (line   6)
   1497 * abort:                                 Usage Basics.        (line  20)
   1498 * abort <1>:                             Commands.            (line  30)
   1499 * activate:                              Initial Setup.       (line   8)
   1500 * active backend:                        Backends Usage Basics.
   1501                                                               (line  11)
   1502 * active backend <1>:                    Troubleshooting.     (line  14)
   1503 * annotation:                            Tooltip Frontends.   (line  52)
   1504 * auto-start:                            Initial Setup.       (line  13)
   1505 * backend:                               Structure.           (line   6)
   1506 * backend <1>:                           Structure.           (line  10)
   1507 * backend <2>:                           Backends Usage Basics.
   1508                                                               (line  11)
   1509 * backend <3>:                           Backends Usage Basics.
   1510                                                               (line  14)
   1511 * backend <4>:                           Troubleshooting.     (line  14)
   1512 * backends:                              Backends.            (line   6)
   1513 * backends <1>:                          Backends Usage Basics.
   1514                                                               (line   6)
   1515 * backends <2>:                          Grouped Backends.    (line   6)
   1516 * backends <3>:                          Package Backends.    (line   6)
   1517 * basics:                                Usage Basics.        (line   6)
   1518 * bug:                                   Troubleshooting.     (line   6)
   1519 * bug <1>:                               Troubleshooting.     (line  25)
   1520 * bundled backends:                      Package Backends.    (line   6)
   1521 * cancel:                                Usage Basics.        (line  20)
   1522 * cancel <1>:                            Commands.            (line  30)
   1523 * candidate:                             Terminology.         (line  10)
   1524 * candidate <1>:                         Usage Basics.        (line  12)
   1525 * candidate <2>:                         Usage Basics.        (line  15)
   1526 * candidate <3>:                         Preview Frontends.   (line   6)
   1527 * color:                                 Tooltip Frontends.   (line 223)
   1528 * color <1>:                             Quick Access a Candidate.
   1529                                                               (line  34)
   1530 * common part:                           Usage Basics.        (line  17)
   1531 * common part <1>:                       Commands.            (line  25)
   1532 * common part <2>:                       Preview Frontends.   (line   6)
   1533 * company-echo:                          Echo Frontends.      (line   6)
   1534 * company-preview:                       Preview Frontends.   (line   6)
   1535 * company-tng:                           Structure.           (line  26)
   1536 * company-tooltip:                       Tooltip Frontends.   (line 223)
   1537 * company-tooltip-search:                Candidates Search.   (line   6)
   1538 * complete:                              Terminology.         (line   6)
   1539 * complete <1>:                          Usage Basics.        (line  12)
   1540 * complete <2>:                          Usage Basics.        (line  15)
   1541 * complete <3>:                          Usage Basics.        (line  17)
   1542 * complete <4>:                          Commands.            (line  21)
   1543 * complete <5>:                          Preview Frontends.   (line   6)
   1544 * completion:                            Terminology.         (line   6)
   1545 * completion <1>:                        Usage Basics.        (line  12)
   1546 * completion <2>:                        Usage Basics.        (line  15)
   1547 * completion <3>:                        Usage Basics.        (line  17)
   1548 * configure:                             Customization.       (line   6)
   1549 * configure <1>:                         Customization Interface.
   1550                                                               (line   6)
   1551 * configure <2>:                         Configuration File.  (line   6)
   1552 * configure <3>:                         Tooltip Frontends.   (line  48)
   1553 * configure <4>:                         Tooltip Frontends.   (line 223)
   1554 * configure <5>:                         Preview Frontends.   (line  25)
   1555 * configure <6>:                         Echo Frontends.      (line  38)
   1556 * configure <7>:                         Candidates Search.   (line  30)
   1557 * configure <8>:                         Quick Access a Candidate.
   1558                                                               (line  25)
   1559 * configure <9>:                         Quick Access a Candidate.
   1560                                                               (line  34)
   1561 * custom:                                Customization.       (line   6)
   1562 * custom <1>:                            Customization Interface.
   1563                                                               (line   6)
   1564 * custom <2>:                            Configuration File.  (line   6)
   1565 * custom <3>:                            Tooltip Frontends.   (line  48)
   1566 * custom <4>:                            Tooltip Frontends.   (line 223)
   1567 * custom <5>:                            Preview Frontends.   (line  25)
   1568 * custom <6>:                            Echo Frontends.      (line  38)
   1569 * custom <7>:                            Candidates Search.   (line  30)
   1570 * custom <8>:                            Quick Access a Candidate.
   1571                                                               (line  25)
   1572 * custom <9>:                            Quick Access a Candidate.
   1573                                                               (line  34)
   1574 * definition:                            Commands.            (line  41)
   1575 * distribution:                          Installation.        (line   6)
   1576 * doc:                                   Commands.            (line  34)
   1577 * duplicate:                             Candidates Post-Processing.
   1578                                                               (line   6)
   1579 * echo:                                  Echo Frontends.      (line   6)
   1580 * enable:                                Initial Setup.       (line   8)
   1581 * error:                                 Troubleshooting.     (line   6)
   1582 * error <1>:                             Troubleshooting.     (line  25)
   1583 * expansion:                             Template Expansion.  (line   6)
   1584 * extensible:                            Structure.           (line   6)
   1585 * face:                                  Tooltip Frontends.   (line 223)
   1586 * face <1>:                              Preview Frontends.   (line   6)
   1587 * face <2>:                              Preview Frontends.   (line  25)
   1588 * face <3>:                              Echo Frontends.      (line   6)
   1589 * face <4>:                              Echo Frontends.      (line  38)
   1590 * face <5>:                              Candidates Search.   (line   6)
   1591 * face <6>:                              Candidates Search.   (line  30)
   1592 * face <7>:                              Filter Candidates.   (line   6)
   1593 * face <8>:                              Quick Access a Candidate.
   1594                                                               (line  34)
   1595 * filter:                                Filter Candidates.   (line   6)
   1596 * finish:                                Usage Basics.        (line  20)
   1597 * finish <1>:                            Commands.            (line  30)
   1598 * font:                                  Tooltip Frontends.   (line 223)
   1599 * font <1>:                              Quick Access a Candidate.
   1600                                                               (line  34)
   1601 * frontend:                              Structure.           (line   6)
   1602 * frontend <1>:                          Structure.           (line  10)
   1603 * frontends:                             Frontends.           (line   6)
   1604 * grouped backends:                      Grouped Backends.    (line   6)
   1605 * icon:                                  Tooltip Frontends.   (line 152)
   1606 * install:                               Installation.        (line   6)
   1607 * interface:                             Tooltip Frontends.   (line  48)
   1608 * interface <1>:                         Tooltip Frontends.   (line 223)
   1609 * interface <2>:                         Preview Frontends.   (line  25)
   1610 * interface <3>:                         Echo Frontends.      (line  38)
   1611 * interface <4>:                         Candidates Search.   (line  30)
   1612 * interface <5>:                         Quick Access a Candidate.
   1613                                                               (line  34)
   1614 * intro:                                 Initial Setup.       (line   6)
   1615 * issue:                                 Troubleshooting.     (line   6)
   1616 * issue tracker:                         Troubleshooting.     (line  25)
   1617 * kind:                                  Tooltip Frontends.   (line 152)
   1618 * location:                              Commands.            (line  41)
   1619 * manual:                                Initial Setup.       (line   8)
   1620 * manual <1>:                            Usage Basics.        (line  10)
   1621 * margin:                                Tooltip Frontends.   (line 141)
   1622 * margin <1>:                            Tooltip Frontends.   (line 160)
   1623 * minor-mode:                            Initial Setup.       (line   6)
   1624 * module:                                Structure.           (line   6)
   1625 * module <1>:                            Structure.           (line  10)
   1626 * navigate:                              Usage Basics.        (line  12)
   1627 * next backend:                          Backends Usage Basics.
   1628                                                               (line  14)
   1629 * non-prefix matches:                    Terminology.         (line  10)
   1630 * package:                               Installation.        (line   6)
   1631 * package backends:                      Package Backends.    (line   6)
   1632 * pluggable:                             Structure.           (line   6)
   1633 * pop-up:                                Tooltip Frontends.   (line   6)
   1634 * prefix matches:                        Terminology.         (line  10)
   1635 * preview:                               Preview Frontends.   (line   6)
   1636 * quick start:                           Initial Setup.       (line   6)
   1637 * quick-access:                          Quick Access a Candidate.
   1638                                                               (line   6)
   1639 * quit:                                  Usage Basics.        (line  20)
   1640 * quit <1>:                              Commands.            (line  30)
   1641 * search:                                Candidates Search.   (line   6)
   1642 * select:                                Usage Basics.        (line  12)
   1643 * select <1>:                            Commands.            (line  11)
   1644 * select <2>:                            Commands.            (line  16)
   1645 * snippet:                               Template Expansion.  (line   6)
   1646 * sort:                                  Candidates Post-Processing.
   1647                                                               (line   6)
   1648 * stop:                                  Usage Basics.        (line  20)
   1649 * stop <1>:                              Commands.            (line  30)
   1650 * TAB:                                   Structure.           (line  26)
   1651 * Tab and Go:                            Structure.           (line  26)
   1652 * template:                              Template Expansion.  (line   6)
   1653 * third-party:                           Structure.           (line  10)
   1654 * third-party <1>:                       Troubleshooting.     (line  17)
   1655 * tooltip:                               Tooltip Frontends.   (line   6)
   1656 * troubleshoot:                          Troubleshooting.     (line   6)
   1657 * usage:                                 Usage Basics.        (line   6)
   1658 
   1659 
   1660 
   1661 Tag Table:
   1662 Node: Top565
   1663 Node: Overview1986
   1664 Node: Terminology2396
   1665 Ref: Terminology-Footnote-13385
   1666 Node: Structure3591
   1667 Node: Getting Started5089
   1668 Node: Installation5369
   1669 Node: Initial Setup5754
   1670 Node: Usage Basics6602
   1671 Node: Commands7367
   1672 Ref: Commands-Footnote-19804
   1673 Node: Customization9971
   1674 Node: Customization Interface10445
   1675 Node: Configuration File10980
   1676 Node: Frontends15648
   1677 Node: Tooltip Frontends16619
   1678 Ref: Tooltip Frontends-Footnote-127388
   1679 Node: Preview Frontends27625
   1680 Ref: Preview Frontends-Footnote-128883
   1681 Node: Echo Frontends29010
   1682 Node: Candidates Search30545
   1683 Node: Filter Candidates31881
   1684 Node: Quick Access a Candidate32663
   1685 Node: Backends34283
   1686 Node: Backends Usage Basics35383
   1687 Ref: Backends Usage Basics-Footnote-136600
   1688 Node: Grouped Backends36684
   1689 Node: Package Backends38315
   1690 Node: Code Completion39246
   1691 Node: Text Completion41617
   1692 Node: File Name Completion46053
   1693 Node: Template Expansion47603
   1694 Node: Candidates Post-Processing48324
   1695 Node: Troubleshooting49803
   1696 Node: Index51478
   1697 Node: Key Index51643
   1698 Node: Variable Index53144
   1699 Node: Function Index57269
   1700 Node: Concept Index61752
   1701 
   1702 End Tag Table
   1703 
   1704 
   1705 Local Variables:
   1706 coding: utf-8
   1707 End: