Minibuffer and Completions in Tandem (mct.el)

Next:   [Index]

Minibuffer and Completions in Tandem (mct.el)

Copyright (C) 2021 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; with no Invariant Sections, with the Front-Cover Texts being “A GNU Manual,” and with the Back-Cover Texts as in (a) below. A copy of the license is included in the section entitled “GNU Free Documentation License.”

(a) The FSF’s Back-Cover Text is: “You have the freedom to copy and modify this GNU manual.”

This manual, written by Protesilaos Stavrou, describes the customization options for ‘mct’ (or ‘mct.el’ and variants), and provides every other piece of information pertinent to it.

The documentation furnished herein corresponds to stable version 0.4.0, released on 2022-01-19. Any reference to a newer feature which does not yet form part of the latest tagged commit, is explicitly marked as such.

Current development target is 0.5.0-dev.


Next: , Previous: , Up: Top   [Index]

1 Overview of MCT

Minibuffer and Completions in Tandem, also known as “MCT”, “Mct”, ‘mct’, or ‘mct.el’, is a package that enhances the default minibuffer and ‘*Completions*’ buffer of Emacs 27 (or higher) so that they work together as part of a unified framework. The idea is to make the presentation and overall functionality be consistent with other popular, vertically aligned completion UIs while leveraging built-in functionality.

The main feature set that unifies the minibuffer and the ‘*Completions*’ buffer consists of commands that cycle between the two, making it seem like they are part of a contiguous space (Basic usage).

MCT tries to find a middle ground between the frugal defaults and the more opinionated completion UIs. This is most evident in its approach on how to present completion candidates. Instead of showing them outright or only displaying them on demand, MCT implements a minimum input threshold as well as a slight delay before it pops up the ‘*Completions*’ buffer and starts updating it to respond to user input.

Customization options control the input threshold (mct-minimum-input) and the delay between live updates (mct-live-update-delay). Similarly, a blocklist and a passlist for commands are on offer:

The user option mct-live-completion controls the overall behaviour of the Completions’ buffer:

Other customizations:


Up: Overview of MCT   [Index]

1.1 MCT in the minibuffer and in regular buffers

Emacs draws a distinction between two types of completion sessions:

The former scenario is what MCT has supported since its inception. Starting with version ‘0.4.0’ it also covers the latter case, though only experimentally (please report any bugs or point towards areas of possible improvement).

To let users fine-tune their setup, MCT provides the mct-minibuffer-mode (formerly mct-mode) as well as the global mct-region-mode.

The decoupling between the two modes makes it possible to configure interchangeable components in a variety of combinations, such as MCT for the minibuffer and the Corfu package for completion-in-region (Extensions). Or the Vertico package for the minibuffer and MCT for in-buffer completion (Alternatives).

We jokingly say that since the introduction of mct-region-mode the acronym “MCT” now stands for “Minibuffer Confines Transcended”—the original was “Minibuffer and Completions in Tandem”.

Interaction model of mct-region-mode.


Next: , Previous: , Up: Top   [Index]

2 Usage

This section outlines the various patterns of interaction that MCT establishes. Note that completion covers two distinct cases, which are reflected in the design of MCT: (i) in the minibuffer and (ii) for in-buffer completion (MCT in the minibuffer and in regular buffers). Most of this section is about the former scenario, which uses the mct-minibuffer-mode. The mct-region-mode is less featureful by comparison.


Next: , Up: Usage   [Index]

2.1 Cyclic behaviour for mct-minibuffer-mode

When mct-minibuffer-mode is enabled, some new keymaps are activated which add commands for cycling between the minibuffer and the completions. Suppose the following standard layout:

-----------------
|        |      |
| Buffers| Buf  |
|        |      |
-----------------
|        |      |
| Buf    | Buf  |
|        |      |
-----------------
-----------------
|               |
|  Completions  |
|               |
-----------------
-----------------
|  Minibuffer   |
-----------------

When inside the minibuffer, pressing ‘C-n’ (or down arrow) takes you to the top of the completions, while ‘C-p’ (or up arrow) moves to the bottom. The commands are mct-switch-to-completions-top for the former and mct-switch-to-completions-bottom for the latter. If the ‘*Completions*’ are not shown, then the buffer pops up automatically and point moves to the given position.

Similarly, while inside the ‘*Completions*’ buffer, ‘C-p’ (or up arrow) at the top of the buffer switches to the minibuffer, while ‘C-n’ (or down arrow) at the bottom of the buffer also goes to the minibuffer. If point is anywhere else inside the buffer, those key bindings perform a regular line motion (if the ‘*Completions*’ are set to a grid view, then the left and right arrow keys perform the corresponding lateral motions). The commands are mct-previous-completion-or-mini and mct-next-completion-or-mini. Both accept an optional numeric argument. If the Nth line lies outside the boundaries of the completions’ buffer, they move the point to the minibuffer.

The display of the ‘*Completions*’ can be toggled at any time from inside the minibuffer with ‘C-l’ (mnemonic is “[l]ist completions” and the command is mct-list-completions-toggle).

By default, the ‘*Completions*’ buffer appears in a window at the bottom of the frame. Users can change its placement by configuring the variable mct-display-buffer-action (its doc string explains how and provides sample code).

This is not the same for in-buffer completion performed by mct-region-mode (Interaction model of mct-region-mode).


Next: , Previous: , Up: Usage   [Index]

2.2 Selecting candidates with mct-minibuffer-mode

There are several ways to select a completion candidate. These pertain to mct-minibuffer-mode, as mct-region-mode only has the meaningful action of expanding the given candidate (with ‘RET’ or ‘TAB’ in the Completions’ buffer (Cyclic behaviour for in-buffer completion)).

  1. Suppose that you are typing ‘mod’ with the intent to select the ‘modus-themes.el’ buffer. To complete the candidate follow up ‘mod’ with the ‘TAB’ key (minibuffer-complete). If the match is unique, the text will be expanded. Otherwise the ‘*Completions*’ buffer will appear. This does not exit the minibuffer, meaning that it does not confirm your choice. To confirm your choice, use ‘RET’. If you ever make a mistake and expand the wrong candidate, just use undo. Lastly note that if the candidates meet the completion-cycle-threshold hitting ‘TAB’ again will switch between them.
  2. While cycling through the completions’ buffer, type ‘RET’ to select and confirm the current candidate (mct-choose-completion-exit). This works for all types of completion prompts.
  3. Similar to the above, but without exiting the minibuffer (i.e. to confirm your choice) is mct-choose-completion-no-exit which is bound to ‘TAB’ in the completions’ buffer. This is particularly useful for certain contexts where selecting a candidate does not necessarily mean that the process has to be finalised (e.g. when using find-file). In those cases, the event triggered by ‘TAB’ is followed by the renewal of the list of completions, where relevant (e.g. ‘TAB’ over a directory in find-file, which then shows the contents of that directory).

    The command can correctly expand completion candidates even when the active style in completion-styles is ‘partial-completion’. In other words, if the minibuffer contains input like ‘~/G/P/m’ and the point is in the completions’ buffer over ‘Git/Projects/mct/’ the minibuffer’ contents will become ‘~/Git/Projects/mct/’ and then show the contents of that directory.

  4. Type ‘M-e’ (mct-edit-completion) in the completions’ buffer to place the current candidate in the minibuffer, without exiting the session. This allows you to edit the text before confirming it. If point is in the minibuffer before performing this action, the current candidate is either the one at the top of the completions’ buffer or that which is under the last known point in said buffer (the last known position is reset when the window is deleted). Internally, mct-edit-completion uses mct-choose-completion-no-exit to expand the completion candidate, so it retains its behaviour (as explained right above).

    Sometimes there is a need to switch to the minibuffer without selecting the candidate at point, such as to retype some part of the input. In those cases, type ‘e’ in the completions’ buffer to move to the minibuffer. The command is called mct-focus-minibuffer, which can also be assigned to the global keymap, though MCT leaves such a decision up to the user (same for mct-focus-mini-or-completions).

  5. Select a candidate by its line number by typing ‘M-g M-g’ in either the minibuffer or the ‘*Completions*’ buffer. This calls the command mct-choose-completion-number which internally enables line numbers and always makes the completions’ buffer visible. Selection in this way exits the minibuffer.

    NOTE: This method only works when mct-completions-format is set to its default value of ‘one-column’. The other formats show completions in a grid view, which makes navigation based on line numbers imprecise.

  6. In prompts that allow the selection of multiple candidates (internally via the completing-read-multiple function) a ‘[CRM]’ label is added to the text of the prompt. The user thus knows that pressing ‘M-RET’ (mct-choose-completion-dwim) in the ‘*Completions*’ will append the candidate at point to the list of selections and keep the completions available so that another item may be selected. Any of the aforementioned applicable methods can confirm the final selection. If, say, you want to pick a total of three candidates, do ‘M-RET’ for the first two and ‘RET’ (mct-choose-completion-exit) for the last one. In contexts that are not CRM-powered, the ‘M-RET’ has the same effect as ‘TAB’ (mct-choose-completion-no-exit).
  7. When point is at the minibuffer, select the current candidate in the completions buffer with ‘C-RET’ (mct-complete-and-exit), which has the same effect as first completing with ‘TAB’ and then immediately exit the minibuffer with the completed candidate as the selected one.

Next: , Previous: , Up: Usage   [Index]

2.3 Other commands for mct-minibuffer-mode


Previous: , Up: Usage   [Index]

2.4 Interaction model of mct-region-mode

When mct-region-mode is enabled, MCT is used for in-buffer completion. In this scenario, the cyclic behaviour is less featureful than when the minibuffer is active (due to the specifics of the underlying commands), so we cover the differences (Cyclic behaviour in the minibuffer).

In terms of its interaction model, mct-region-mode only gets enabled manually either by pressing ‘TAB’ or ‘C-M-i’ (complete-symbol) in supporting major modes. The ‘*Completions*’ buffer pops up and is narrowed live to match any subsequent user input. While the buffer is visible, we are performing completion-in-region, which means that the Completions can be narrowed live by typing further. Furthermore, ‘C-n’ or ‘C-p’ will move the point to the top/bottom of the Completions’ buffer from where the user can select a candidate with ‘RET’.

In-buffer completion is always invoked manually. There is no minimum input threshold and no delay between updates while live-updating of the ‘*Completions*’ buffer is performed. If the Completions are not visible, then no completion-in-region takes place and thus mct-region-mode should have no effect.

By default, the placement of the Completions for this type of interaction is below the current buffer (as opposed to the bottom of the frame for mct-minibuffer-mode). It looks like this:

------------------------
|               |      |
| Current buffer| Buf  |
|               |      |
------------------------
|               |      |
|  Completions  | Buf  |
|               |      |
------------------------
|        |      |      |
|  Buf   | Buf  | Buf  |
|        |      |      |
------------------------

While inside the Completions’ buffer, ‘C-n’ and ‘C-p’ move to the next and previous line, respectively. When they reach the top/bottom boundaries of the Completions’ buffer, they switch focus back to the buffer that started the completion. However, and unlike mct-minibuffer-mode, they do not keep the ‘*Completions*’ window around. This is because we cannot tell whether the user wanted to continue with a new completion upon returning to the buffer of origin or perform some other motion/command (in the minibuffer we can make that assumption because the minibuffer is purpose-specific, so for as long as it is active, the completion session goes on). As such, completion-in-region must be restarted after cycling out of the ‘*Completions*’.

To cancel in-buffer completion, type ‘C-g’ either before switching to the Completions’ buffer or while inside of it.

The only customization option for mct-region-mode pertains to the presentation of the ‘*Completions*’: mct-region-completions-format. By default, it uses the same style as mct-completions-format, though it can be configured to, for example, display candidates in a grid with either of the ‘horizontal’ or ‘vertical’ values (on Emacs 27, candidates are always displayed in a grid, as the ‘one-column’ layout was introduced in Emacs 28).


Next: , Previous: , Up: Top   [Index]

3 Installation


Next: , Up: Installation   [Index]

3.1 Install the package

mct’ is available on the official GNU ELPA archive for users of Emacs version 27 or higher. One can install the package without any further configuration. The following commands shall suffice:

M-x package-refresh-contents
M-x package-install RET mct

Previous: , Up: Installation   [Index]

3.2 Manual installation method

Assuming your Emacs files are found in ‘~/.emacs.d/’, execute the following commands in a shell prompt:

cd ~/.emacs.d

# Create a directory for manually-installed packages
mkdir manual-packages

# Go to the new directory
cd manual-packages

# Clone this repo and name it "mct"
git clone https://gitlab.com/protesilaos/mct.git mct

Finally, in your ‘init.el’ (or equivalent) evaluate this:

;; Make Elisp files in that directory available to the user.
(add-to-list 'load-path "~/.emacs.d/manual-packages/mct")

Everything is in place to set up the package.


Next: , Previous: , Up: Top   [Index]

4 Sample setup

Minimal setup for the minibuffer and in-buffer completion:

(require 'mct)
(mct-minibuffer-mode 1)
(mct-region-mode 1)

And with more options:

(require 'mct)

(setq mct-remove-shadowed-file-names t) ; works when `file-name-shadow-mode' is enabled
(setq mct-hide-completion-mode-line t)
(setq mct-show-completion-line-numbers nil)
(setq mct-apply-completion-stripes t)
(setq mct-minimum-input 3)
(setq mct-live-update-delay 0.6)
(setq mct-completions-format 'one-column)

;; NOTE: `mct-completion-blocklist' can be used for commands with lots
;; of candidates, depending also on how low `mct-minimum-input' is.
;; With the settings shown here this is not required, otherwise I would
;; use something like this:
;;
;; (setq mct-completion-blocklist
;;       '( describe-symbol describe-function describe-variable
;;          execute-extended-command insert-char))
(setq mct-completion-blocklist nil)

;; This is for commands that should always pop up the completions'
;; buffer.  It circumvents the default method of waiting for some user
;; input (see `mct-minimum-input') before displaying and updating the
;; completions' buffer.
(setq mct-completion-passlist
      '(imenu
        Info-goto-node
        Info-index
        Info-menu
        vc-retrieve-tag))

;; You can place the Completions' buffer wherever you want, by following
;; the syntax of `display-buffer'.  For example, try this:

;; (setq mct-display-buffer-action
;;       (quote ((display-buffer-reuse-window
;;                display-buffer-in-side-window)
;;               (side . left)
;;               (slot . 99)
;;               (window-width . 0.3))))

(mct-minibuffer-mode 1)

;; Optionally use MCT for in-buffer completion (though `corfu' is a
;; better option).
(mct-region-mode 1)

Other useful extras from the Emacs source code (read their doc strings):

(setq completion-styles
      '(basic substring initials flex partial-completion))
(setq completion-category-overrides
      '((file (styles . (basic partial-completion initials substring)))))

(setq completion-cycle-threshold 2)
(setq completion-ignore-case t)
(setq completion-show-inline-help nil)

(setq completions-detailed t)

(setq enable-recursive-minibuffers t)
(setq minibuffer-eldef-shorten-default t)

(setq read-buffer-completion-ignore-case t)
(setq read-file-name-completion-ignore-case t)

(setq resize-mini-windows t)
(setq minibuffer-eldef-shorten-default t)

(file-name-shadow-mode 1)
(minibuffer-depth-indicate-mode 1)
(minibuffer-electric-default-mode 1)

;; Do not allow the cursor in the minibuffer prompt
(setq minibuffer-prompt-properties
      '(read-only t cursor-intangible t face minibuffer-prompt))

(add-hook 'minibuffer-setup-hook #'cursor-intangible-mode)

;;; Minibuffer history
(require 'savehist)
(setq savehist-file (locate-user-emacs-file "savehist"))
(setq history-length 10000)
(setq history-delete-duplicates t)
(setq savehist-save-minibuffer-history t)
(add-hook 'after-init-hook #'savehist-mode)

;;; Indentation and the TAB key
(setq-default tab-always-indent 'complete) ; useful for `mct-region-mode'
(setq-default tab-first-completion 'word-or-paren-or-punct) ; Emacs 27

;;; Extensions

;;;; Enable Consult previews in the Completions buffer.
;; Requires the `consult' package.
(add-hook 'completion-list-mode-hook #'consult-preview-at-point-mode)

;;;; Setup for Orderless
;; Requires the `orderless' package

;; We make the SPC key insert a literal space and the same for the
;; question mark.  Spaces are used to delimit orderless groups, while
;; the quedtion mark is a valid regexp character.
(let ((map minibuffer-local-completion-map))
  (define-key map (kbd "SPC") nil)
  (define-key map (kbd "?") nil))

;; Because SPC works for Orderless and is trivial to activate, I like to
;; put `orderless' at the end of my `completion-styles'.  Like this:
(setq completion-styles
      '(basic substring initials flex partial-completion orderless))
(setq completion-category-overrides
      '((file (styles . (basic partial-completion orderless)))))

Next: , Previous: , Up: Top   [Index]

5 Keymaps

MCT defines its own keymaps, which extend those that are active in the minibuffer and the ‘*Completions*’ buffer, respectively:

You can invoke describe-keymap to learn more about them.

If you want to edit any key bindings, do it in these keymaps, not in those they extend and override (the names of the original ones are the same as above, minus the ‘mct-’ prefix).


Next: , Previous: , Up: Top   [Index]

6 User-level tweaks or custom code

In this section we cover custom code that builds on what MCT offers.


Up: User-level tweaks or custom code   [Index]

6.1 MCT in the current or the other window

Over at the rde project, Andrew Tropin configures MCT to display the Completions’ buffer in either of two places:

Current window

This is the default behaviour. It means that completions are presented where the user is already focused on, instead of the bottom of the display or some side window.

Other window

The least recently used window when the command that performs completion matches certain categories whose candidates are best shown next to the current window/context. For example, Imenu (and extensions like consult-imenu) creates a dynamically generated index of “points of interest” in the current buffer, so it is useful to have this displayed in the other window.

Implementation details and particular preferences aside, this is a great example of using the various display-buffer functions to control the placement of the ‘*Completions*’ buffer.

(defvar rde-completion-categories-other-window
  '(imenu)
  "Completion categories that has to be in other window than
current, otherwise preview functionallity will fail the party.")

(defvar rde-completion-categories-not-show-candidates-on-setup
  '(command variable function)
  "Completion categories that has to be in other window than
current, otherwise preview functionallity will fail the party.")

(defun rde-display-mct-buffer-pop-up-if-apropriate (buffer alist)
  "Call `display-buffer-pop-up-window' if the completion category
one of `rde-completion-categories-other-window', it will make
sure that we don't use same window for completions, which should
be in separate window."
  (if (memq (mct--completion-category)
            rde-completion-categories-other-window)
      (display-buffer-pop-up-window buffer alist)
    nil))

(defun rde-display-mct-buffer-apropriate-window (buffer alist)
  "Displays completion buffer in the same window, where completion
was initiated (most recent one), but in case, when compeltion
buffer should be displayed in other window use least recent one."
  (let* ((window (if (memq (mct--completion-category)
                           rde-completion-categories-other-window)
                     (get-lru-window (selected-frame) nil nil)
                   (get-mru-window (selected-frame) nil nil))))
    (window--display-buffer buffer window 'reuse alist)))

(setq mct-display-buffer-action
      (quote ((display-buffer-reuse-window
               rde-display-mct-buffer-pop-up-if-apropriate
               rde-display-mct-buffer-apropriate-window))))

(defun rde-mct-show-completions ()
  "Instantly shows completion candidates for categories listed in
`rde-completion-categories-show-candidates-on-setup'."
  (unless (memq (mct--completion-category)
                rde-completion-categories-not-show-candidates-on-setup)
    (setq-local mct-minimum-input 0)
    (mct--live-completions)))

(add-hook 'minibuffer-setup-hook 'rde-mct-show-completions)

Next: , Previous: , Up: Top   [Index]

7 Extensions

MCT only tweaks the default minibuffer. To get more out of it, consider these exceptionally well-crafted extras:

Consult by Daniel Mendler

Adds several commands that make interacting with the minibuffer more powerful. There also are multiple packages that build on it, such as consult-dir by Karthik Chikmagalur and consult-notmuch by José Antonio Ortega Ruiz.

Embark by Omar Antolín Camarena

Provides configurable contextual actions for completions and many other constructs inside buffers. A genius package!

Marginalia by Daniel and Omar

Displays informative annotations for all known types of completion candidates.

Orderless by Omar

A completion style that matches a variety of patterns (regexp, flex, initialism, etc.) regardless of the order they appear in.

all-the-icons-completion by Itai Y. Efrat

Glue code that adds icons from the ‘all-the-icons’ package to the ‘*Completions*’ buffer. It can make things prettier and/or more informative, while it can also be combined with Marginalia.

MCT does support the use-case of completion-in-region. This is the kind of completion session that does not involve the minibuffer and is instead about in-buffer text expansion. However, you may prefer:

Corfu by Daniel Mendler

An interface for the completion-in-region which uses a child frame (basically a pop-up) at the position of the cursor to display candidates. As with all of Daniel’s packages, Corfu aims for a clean implementation that does the right thing by being consistent with core Emacs mechanisms.

Cape also by Daniel

Additional completion-at-point-functions (CAPFs) that extend those of core Emacs. These backends can be used by packages that visualise completion-in-region such as Corfu and MCT.


Next: , Up: Extensions   [Index]

7.1 Enable Consult previews

One of the nice features of the Consult package is the ability to preview the candidate at point. All we need to enable it in the ‘*Completions*’ buffer is the following snippet:

(add-hook 'completion-list-mode-hook #'consult-preview-at-point-mode)

Previous: , Up: Extensions   [Index]

7.2 Avoid conflict between MCT and Corfu

Daniel Mendler’s ‘corfu’ package provides an alternative to the mct-region-mode (MCT in the minibuffer and in regular buffers). Given that MCT’s implementation is a global minor-mode, chances are that users of both will run into weird issues with conflicting functionality. The following snippet from Corfu’s README can be added to user configuration files to avoid any potential trouble when using commands such as eval-expression (bound to ‘M-:’ by default):

(defun corfu-in-minibuffer ()
  "Enable Corfu in the minibuffer only if Mct/Vertico are not active."
  (unless (or (mct--minibuffer-p) vertico--input)
    (corfu-mode 1)))

(add-hook 'minibuffer-setup-hook #'corfu-in-minibuffer 1)

Next: , Previous: , Up: Top   [Index]

8 Alternatives

In the grand scheme of things, it may be helpful to think of MCT as proof-of-concept on how the default Emacs completion can become more expressive. MCT’s value rests in its potential to inspire developers to (i) patch Emacs so that its out-of-the-box completion is more interactive, and (ii) expose the shortcomings in the current implementation of the ‘*Completions*’ buffer, which should again provide an impetus for further changes to Emacs. Otherwise, MCT is meant for users who can tolerate the status quo and simply want a thin layer of interactivity for minibuffer completion, in-buffer completion, and their intersection with the Completions’ buffer.

Like MCT, these alternatives provide a thin layer of functionality over the built-in infrastructure. Unlike MCT, they are not constrained by the design of the ‘*Completions*’ buffer and concomitant functionality. They all make for a natural complement to the standard Emacs experience (also Extensions).

Vertico by Daniel Mendler

this is a more mature and feature-rich package with a large user base and a highly competent maintainer.

Vertico has some performance optimizations on how candidates are sorted and presented, which means that it displays results right away without any noticeable performance penalty. Whereas MCT does not change the underlying behaviour of how candidates are displayed. As such, MCT will be slower in scenaria where there are lots of candidates because core Emacs lacks those optimizations. One such case is with the describe-symbol (‘C-h o’) prompt. If the user asks for the completions’ buffer without inputting any character (so without narrowing the list), there will be a noticeable delay before the buffer is rendered. This is mitigated in MCT by the requirement for mct-minimum-input, though the underlying mechanics remain intact.

In terms of the interaction model, the main difference between Vertico and MCT is that the former uses the minibuffer by default and shows the completions there. The minibuffer is expanded to show the candidates in a vertical list. Whereas MCT keeps the ‘*Completions*’ buffer and the minibuffer as separate entities, the way standard Emacs does it.

The presence of a fully fledged buffer means that the user can invoke all relevant commands at their disposal, such as to write the buffer to a file for future review, use Isearch to move around, copy a string or rectangle to a register, and so on. Also, the placement of such a buffer is configurable (as with all buffers—though refer, in particular, to mct-display-buffer-action).

Vertico has official extensions which can make it work exactly like MCT without any of MCT’s drawbacks. These extensions can also expand Vertico’s powers such as by providing granular control over the exact style of presentation for any given completion category (e.g. display Imenu in a separate buffer, show the switch-to-buffer list horizontally in the minibuffer, and present find-file in a vertical list—whatever the user wants).

All things considered, there is no compelling reason why one may prefer MCT over Vertico in terms of the available functionality: Vertico is better.

Elmo - Embark Live MOde for Emacs by Karthik Chikmagalur

this package is best described as a sibling of MCT both in terms of its functionality and overall interaction model. In fact, the cyclic motions that are at the core of the MCT experience were first developed as part of my personal Emacs setup to cycle between the minibuffer and Embark’s “live completions” buffer. That was until Emacs28 got some refinements to the presentation of the ‘*Completions*’ buffer which allowed for a vertical, single-column view.

Elmo can, in principle, have identical functionality with MCT, given that the only substantive difference is that the former uses an Embark buffer to show live-updating completions, while the latter relies on the generic ‘*Completions*’ buffer.

For users who are on Emacs 27 and who need a single-column view, Elmo is a better choice because MCT can only display such a view on Emacs 28 or higher (though it has been meticulously tested with the grid views of Emacs 27 and should work perfectly fine with them).

Icomplete and fido-mode (built-in, multiple authors)

Icomplete is closer in spirit to Vertico, as it too uses the minibuffer to display completion candidates. By default, it presents the list horizontally, though there exists icomplete-vertical-mode (and fido-vertical-mode).

For our purposes, Icomplete and Fido are the same in terms of the paradigm they follow. The latter is a re-spin of the former, as it adjusts certain variables and binds some commands for the convenience of the end-user. fido-mode and its accoutrements are defined in ‘icomplete.el’.

What MCT borrows from Icomplete is the mct-backward-updir command, the tidying of the shadowed file paths, and ideas for the input delay (explained elsewhere in this document). Internally, I also learnt how to extend local keymaps by studying ‘icomplete.el’.

I had used Icomplete for several months before moving to what now has become ‘mct.el’. I think it is excellent at providing a thin layer over the built-in infrastructure.


Next: , Previous: , Up: Top   [Index]

9 Acknowledgements

MCT is meant to be a collective effort. Every bit of help matters.

Author/maintainer

Protesilaos Stavrou.

Contributions to code or documentation

Daniel Mendler, James Norman Vladimir Cash, José Antonio Ortega Ruiz, Juri Linkov, Philip Kaludercic.

Ideas and user feedback

Andrew Tropin, Benjamin (@zealotrush), Case Duckworth, Jonathan Irving, José Antonio Ortega Ruiz, Kostadin Ninev, Manuel Uberti, Philip Kaludercic, Theodor Thornhill.

Inspiration for certain features

icomplete.el’ (built-in—multiple authors), Daniel Mendler (‘vertico’), Omar Antolín Camarena (‘embark’, ‘live-completions’), Štěpán Němec (‘stripes.el’).


Next: , Previous: , Up: Top   [Index]

10 Official sources

Manual

https://protesilaos.com/emacs/mct

Change log

https://protesilaos.com/emacs/mct-changelog

Source code

https://gitlab.com/protesilaos/mct


Next: , Previous: , Up: Top   [Index]

Appendix A GNU Free Documentation License

Version 1.3, 3 November 2008
Copyright © 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
https://fsf.org/

Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
  1. PREAMBLE

    The purpose of this License is to make a manual, textbook, or other functional and useful document free in the sense of freedom: to assure everyone the effective freedom to copy and redistribute it, with or without modifying it, either commercially or noncommercially. Secondarily, this License preserves for the author and publisher a way to get credit for their work, while not being considered responsible for modifications made by others.

    This License is a kind of “copyleft”, which means that derivative works of the document must themselves be free in the same sense. It complements the GNU General Public License, which is a copyleft license designed for free software.

    We have designed this License in order to use it for manuals for free software, because free software needs free documentation: a free program should come with manuals providing the same freedoms that the software does. But this License is not limited to software manuals; it can be used for any textual work, regardless of subject matter or whether it is published as a printed book. We recommend this License principally for works whose purpose is instruction or reference.

  2. APPLICABILITY AND DEFINITIONS

    This License applies to any manual or other work, in any medium, that contains a notice placed by the copyright holder saying it can be distributed under the terms of this License. Such a notice grants a world-wide, royalty-free license, unlimited in duration, to use that work under the conditions stated herein. The “Document”, below, refers to any such manual or work. Any member of the public is a licensee, and is addressed as “you”. You accept the license if you copy, modify or distribute the work in a way requiring permission under copyright law.

    A “Modified Version” of the Document means any work containing the Document or a portion of it, either copied verbatim, or with modifications and/or translated into another language.

    A “Secondary Section” is a named appendix or a front-matter section of the Document that deals exclusively with the relationship of the publishers or authors of the Document to the Document’s overall subject (or to related matters) and contains nothing that could fall directly within that overall subject. (Thus, if the Document is in part a textbook of mathematics, a Secondary Section may not explain any mathematics.) The relationship could be a matter of historical connection with the subject or with related matters, or of legal, commercial, philosophical, ethical or political position regarding them.

    The “Invariant Sections” are certain Secondary Sections whose titles are designated, as being those of Invariant Sections, in the notice that says that the Document is released under this License. If a section does not fit the above definition of Secondary then it is not allowed to be designated as Invariant. The Document may contain zero Invariant Sections. If the Document does not identify any Invariant Sections then there are none.

    The “Cover Texts” are certain short passages of text that are listed, as Front-Cover Texts or Back-Cover Texts, in the notice that says that the Document is released under this License. A Front-Cover Text may be at most 5 words, and a Back-Cover Text may be at most 25 words.

    A “Transparent” copy of the Document means a machine-readable copy, represented in a format whose specification is available to the general public, that is suitable for revising the document straightforwardly with generic text editors or (for images composed of pixels) generic paint programs or (for drawings) some widely available drawing editor, and that is suitable for input to text formatters or for automatic translation to a variety of formats suitable for input to text formatters. A copy made in an otherwise Transparent file format whose markup, or absence of markup, has been arranged to thwart or discourage subsequent modification by readers is not Transparent. An image format is not Transparent if used for any substantial amount of text. A copy that is not “Transparent” is called “Opaque”.

    Examples of suitable formats for Transparent copies include plain ASCII without markup, Texinfo input format, LaTeX input format, SGML or XML using a publicly available DTD, and standard-conforming simple HTML, PostScript or PDF designed for human modification. Examples of transparent image formats include PNG, XCF and JPG. Opaque formats include proprietary formats that can be read and edited only by proprietary word processors, SGML or XML for which the DTD and/or processing tools are not generally available, and the machine-generated HTML, PostScript or PDF produced by some word processors for output purposes only.

    The “Title Page” means, for a printed book, the title page itself, plus such following pages as are needed to hold, legibly, the material this License requires to appear in the title page. For works in formats which do not have any title page as such, “Title Page” means the text near the most prominent appearance of the work’s title, preceding the beginning of the body of the text.

    The “publisher” means any person or entity that distributes copies of the Document to the public.

    A section “Entitled XYZ” means a named subunit of the Document whose title either is precisely XYZ or contains XYZ in parentheses following text that translates XYZ in another language. (Here XYZ stands for a specific section name mentioned below, such as “Acknowledgements”, “Dedications”, “Endorsements”, or “History”.) To “Preserve the Title” of such a section when you modify the Document means that it remains a section “Entitled XYZ” according to this definition.

    The Document may include Warranty Disclaimers next to the notice which states that this License applies to the Document. These Warranty Disclaimers are considered to be included by reference in this License, but only as regards disclaiming warranties: any other implication that these Warranty Disclaimers may have is void and has no effect on the meaning of this License.

  3. VERBATIM COPYING

    You may copy and distribute the Document in any medium, either commercially or noncommercially, provided that this License, the copyright notices, and the license notice saying this License applies to the Document are reproduced in all copies, and that you add no other conditions whatsoever to those of this License. You may not use technical measures to obstruct or control the reading or further copying of the copies you make or distribute. However, you may accept compensation in exchange for copies. If you distribute a large enough number of copies you must also follow the conditions in section 3.

    You may also lend copies, under the same conditions stated above, and you may publicly display copies.

  4. COPYING IN QUANTITY

    If you publish printed copies (or copies in media that commonly have printed covers) of the Document, numbering more than 100, and the Document’s license notice requires Cover Texts, you must enclose the copies in covers that carry, clearly and legibly, all these Cover Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on the back cover. Both covers must also clearly and legibly identify you as the publisher of these copies. The front cover must present the full title with all words of the title equally prominent and visible. You may add other material on the covers in addition. Copying with changes limited to the covers, as long as they preserve the title of the Document and satisfy these conditions, can be treated as verbatim copying in other respects.

    If the required texts for either cover are too voluminous to fit legibly, you should put the first ones listed (as many as fit reasonably) on the actual cover, and continue the rest onto adjacent pages.

    If you publish or distribute Opaque copies of the Document numbering more than 100, you must either include a machine-readable Transparent copy along with each Opaque copy, or state in or with each Opaque copy a computer-network location from which the general network-using public has access to download using public-standard network protocols a complete Transparent copy of the Document, free of added material. If you use the latter option, you must take reasonably prudent steps, when you begin distribution of Opaque copies in quantity, to ensure that this Transparent copy will remain thus accessible at the stated location until at least one year after the last time you distribute an Opaque copy (directly or through your agents or retailers) of that edition to the public.

    It is requested, but not required, that you contact the authors of the Document well before redistributing any large number of copies, to give them a chance to provide you with an updated version of the Document.

  5. MODIFICATIONS

    You may copy and distribute a Modified Version of the Document under the conditions of sections 2 and 3 above, provided that you release the Modified Version under precisely this License, with the Modified Version filling the role of the Document, thus licensing distribution and modification of the Modified Version to whoever possesses a copy of it. In addition, you must do these things in the Modified Version:

    1. Use in the Title Page (and on the covers, if any) a title distinct from that of the Document, and from those of previous versions (which should, if there were any, be listed in the History section of the Document). You may use the same title as a previous version if the original publisher of that version gives permission.
    2. List on the Title Page, as authors, one or more persons or entities responsible for authorship of the modifications in the Modified Version, together with at least five of the principal authors of the Document (all of its principal authors, if it has fewer than five), unless they release you from this requirement.
    3. State on the Title page the name of the publisher of the Modified Version, as the publisher.
    4. Preserve all the copyright notices of the Document.
    5. Add an appropriate copyright notice for your modifications adjacent to the other copyright notices.
    6. Include, immediately after the copyright notices, a license notice giving the public permission to use the Modified Version under the terms of this License, in the form shown in the Addendum below.
    7. Preserve in that license notice the full lists of Invariant Sections and required Cover Texts given in the Document’s license notice.
    8. Include an unaltered copy of this License.
    9. Preserve the section Entitled “History”, Preserve its Title, and add to it an item stating at least the title, year, new authors, and publisher of the Modified Version as given on the Title Page. If there is no section Entitled “History” in the Document, create one stating the title, year, authors, and publisher of the Document as given on its Title Page, then add an item describing the Modified Version as stated in the previous sentence.
    10. Preserve the network location, if any, given in the Document for public access to a Transparent copy of the Document, and likewise the network locations given in the Document for previous versions it was based on. These may be placed in the “History” section. You may omit a network location for a work that was published at least four years before the Document itself, or if the original publisher of the version it refers to gives permission.
    11. For any section Entitled “Acknowledgements” or “Dedications”, Preserve the Title of the section, and preserve in the section all the substance and tone of each of the contributor acknowledgements and/or dedications given therein.
    12. Preserve all the Invariant Sections of the Document, unaltered in their text and in their titles. Section numbers or the equivalent are not considered part of the section titles.
    13. Delete any section Entitled “Endorsements”. Such a section may not be included in the Modified Version.
    14. Do not retitle any existing section to be Entitled “Endorsements” or to conflict in title with any Invariant Section.
    15. Preserve any Warranty Disclaimers.

    If the Modified Version includes new front-matter sections or appendices that qualify as Secondary Sections and contain no material copied from the Document, you may at your option designate some or all of these sections as invariant. To do this, add their titles to the list of Invariant Sections in the Modified Version’s license notice. These titles must be distinct from any other section titles.

    You may add a section Entitled “Endorsements”, provided it contains nothing but endorsements of your Modified Version by various parties—for example, statements of peer review or that the text has been approved by an organization as the authoritative definition of a standard.

    You may add a passage of up to five words as a Front-Cover Text, and a passage of up to 25 words as a Back-Cover Text, to the end of the list of Cover Texts in the Modified Version. Only one passage of Front-Cover Text and one of Back-Cover Text may be added by (or through arrangements made by) any one entity. If the Document already includes a cover text for the same cover, previously added by you or by arrangement made by the same entity you are acting on behalf of, you may not add another; but you may replace the old one, on explicit permission from the previous publisher that added the old one.

    The author(s) and publisher(s) of the Document do not by this License give permission to use their names for publicity for or to assert or imply endorsement of any Modified Version.

  6. COMBINING DOCUMENTS

    You may combine the Document with other documents released under this License, under the terms defined in section 4 above for modified versions, provided that you include in the combination all of the Invariant Sections of all of the original documents, unmodified, and list them all as Invariant Sections of your combined work in its license notice, and that you preserve all their Warranty Disclaimers.

    The combined work need only contain one copy of this License, and multiple identical Invariant Sections may be replaced with a single copy. If there are multiple Invariant Sections with the same name but different contents, make the title of each such section unique by adding at the end of it, in parentheses, the name of the original author or publisher of that section if known, or else a unique number. Make the same adjustment to the section titles in the list of Invariant Sections in the license notice of the combined work.

    In the combination, you must combine any sections Entitled “History” in the various original documents, forming one section Entitled “History”; likewise combine any sections Entitled “Acknowledgements”, and any sections Entitled “Dedications”. You must delete all sections Entitled “Endorsements.”

  7. COLLECTIONS OF DOCUMENTS

    You may make a collection consisting of the Document and other documents released under this License, and replace the individual copies of this License in the various documents with a single copy that is included in the collection, provided that you follow the rules of this License for verbatim copying of each of the documents in all other respects.

    You may extract a single document from such a collection, and distribute it individually under this License, provided you insert a copy of this License into the extracted document, and follow this License in all other respects regarding verbatim copying of that document.

  8. AGGREGATION WITH INDEPENDENT WORKS

    A compilation of the Document or its derivatives with other separate and independent documents or works, in or on a volume of a storage or distribution medium, is called an “aggregate” if the copyright resulting from the compilation is not used to limit the legal rights of the compilation’s users beyond what the individual works permit. When the Document is included in an aggregate, this License does not apply to the other works in the aggregate which are not themselves derivative works of the Document.

    If the Cover Text requirement of section 3 is applicable to these copies of the Document, then if the Document is less than one half of the entire aggregate, the Document’s Cover Texts may be placed on covers that bracket the Document within the aggregate, or the electronic equivalent of covers if the Document is in electronic form. Otherwise they must appear on printed covers that bracket the whole aggregate.

  9. TRANSLATION

    Translation is considered a kind of modification, so you may distribute translations of the Document under the terms of section 4. Replacing Invariant Sections with translations requires special permission from their copyright holders, but you may include translations of some or all Invariant Sections in addition to the original versions of these Invariant Sections. You may include a translation of this License, and all the license notices in the Document, and any Warranty Disclaimers, provided that you also include the original English version of this License and the original versions of those notices and disclaimers. In case of a disagreement between the translation and the original version of this License or a notice or disclaimer, the original version will prevail.

    If a section in the Document is Entitled “Acknowledgements”, “Dedications”, or “History”, the requirement (section 4) to Preserve its Title (section 1) will typically require changing the actual title.

  10. TERMINATION

    You may not copy, modify, sublicense, or distribute the Document except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, or distribute it is void, and will automatically terminate your rights under this License.

    However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.

    Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.

    Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, receipt of a copy of some or all of the same material does not give you any rights to use it.

  11. FUTURE REVISIONS OF THIS LICENSE

    The Free Software Foundation may publish new, revised versions of the GNU Free Documentation License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. See https://www.gnu.org/licenses/.

    Each version of the License is given a distinguishing version number. If the Document specifies that a particular numbered version of this License “or any later version” applies to it, you have the option of following the terms and conditions either of that specified version or of any later version that has been published (not as a draft) by the Free Software Foundation. If the Document does not specify a version number of this License, you may choose any version ever published (not as a draft) by the Free Software Foundation. If the Document specifies that a proxy can decide which future versions of this License can be used, that proxy’s public statement of acceptance of a version permanently authorizes you to choose that version for the Document.

  12. RELICENSING

    “Massive Multiauthor Collaboration Site” (or “MMC Site”) means any World Wide Web server that publishes copyrightable works and also provides prominent facilities for anybody to edit those works. A public wiki that anybody can edit is an example of such a server. A “Massive Multiauthor Collaboration” (or “MMC”) contained in the site means any set of copyrightable works thus published on the MMC site.

    “CC-BY-SA” means the Creative Commons Attribution-Share Alike 3.0 license published by Creative Commons Corporation, a not-for-profit corporation with a principal place of business in San Francisco, California, as well as future copyleft versions of that license published by that same organization.

    “Incorporate” means to publish or republish a Document, in whole or in part, as part of another Document.

    An MMC is “eligible for relicensing” if it is licensed under this License, and if all works that were first published under this License somewhere other than this MMC, and subsequently incorporated in whole or in part into the MMC, (1) had no cover texts or invariant sections, and (2) were thus incorporated prior to November 1, 2008.

    The operator of an MMC Site may republish an MMC contained in the site under CC-BY-SA on the same site at any time before August 1, 2009, provided the MMC is eligible for relicensing.

ADDENDUM: How to use this License for your documents

To use this License in a document you have written, include a copy of the License in the document and put the following copyright and license notices just after the title page:

  Copyright (C)  year  your name.
  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;
  with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
  Texts.  A copy of the license is included in the section entitled ``GNU
  Free Documentation License''.

If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, replace the “with…Texts.” line with this:

    with the Invariant Sections being list their titles, with
    the Front-Cover Texts being list, and with the Back-Cover Texts
    being list.

If you have Invariant Sections without Cover Texts, or some other combination of the three, merge those two alternatives to suit the situation.

If your document contains nontrivial examples of program code, we recommend releasing these examples in parallel under your choice of free software license, such as the GNU General Public License, to permit their use in free software.


Previous: , Up: Top   [Index]

B Indices


Next: , Up: Indices   [Index]

B.1 Function index

Jump to:   M  
Index Entry  Section

M
mct-backward-updir: Other commands for mct-minibuffer-mode
mct-choose-completion-dwim: Selecting candidates with mct-minibuffer-mode
mct-choose-completion-exit: Selecting candidates with mct-minibuffer-mode
mct-choose-completion-no-exit: Selecting candidates with mct-minibuffer-mode
mct-choose-completion-number: Overview of MCT
mct-choose-completion-number: Selecting candidates with mct-minibuffer-mode
mct-complete-and-exit: Selecting candidates with mct-minibuffer-mode
mct-edit-completion: Selecting candidates with mct-minibuffer-mode
mct-focus-minibuffer: Selecting candidates with mct-minibuffer-mode
mct-list-completions-toggle: Cyclic behaviour for mct-minibuffer-mode
mct-minibuffer-mode: MCT in the minibuffer and in regular buffers
mct-next-completion-group: Other commands for mct-minibuffer-mode
mct-next-completion-or-mini: Cyclic behaviour for mct-minibuffer-mode
mct-previous-completion-group: Other commands for mct-minibuffer-mode
mct-previous-completion-or-mini: Cyclic behaviour for mct-minibuffer-mode
mct-region-mode: MCT in the minibuffer and in regular buffers
mct-switch-to-completions-bottom: Cyclic behaviour for mct-minibuffer-mode
mct-switch-to-completions-top: Cyclic behaviour for mct-minibuffer-mode

Jump to:   M  

Next: , Previous: , Up: Indices   [Index]

B.2 Variable index

Jump to:   M  
Index Entry  Section

M
mct-apply-completion-stripes: Overview of MCT
mct-completion-blocklist: Overview of MCT
mct-completion-list-mode-map: Keymaps
mct-completion-passlist: Overview of MCT
mct-completions-format: Selecting candidates with mct-minibuffer-mode
mct-display-buffer-action: Cyclic behaviour for mct-minibuffer-mode
mct-hide-completion-mode-line: Overview of MCT
mct-live-completion: Overview of MCT
mct-live-update-delay: Overview of MCT
mct-minibuffer-local-completion-map: Keymaps
mct-minibuffer-local-filename-completion-map: Keymaps
mct-minibuffer-mode: MCT in the minibuffer and in regular buffers
mct-minimum-input: Overview of MCT
mct-region-completions-format: Interaction model of mct-region-mode
mct-region-mode: MCT in the minibuffer and in regular buffers
mct-remove-shadowed-file-name: Overview of MCT
mct-stripe: Overview of MCT

Jump to:   M  

Previous: , Up: Indices   [Index]

B.3 Concept index

Jump to:   A   C   E   I   K   M   O   S  
Index Entry  Section

A
Alternatives to MCT: Alternatives

C
Candidate selection for minibuffer completion: Selecting candidates with mct-minibuffer-mode
Contributors: Acknowledgements
Custom tweaks or extensions: User-level tweaks or custom code
Cyclic behaviour in the minibuffer: Cyclic behaviour for mct-minibuffer-mode

E
Extra packages: Extensions

I
Interactions for in-buffer completion: Interaction model of mct-region-mode

K
Keymaps: Keymaps

M
Miscellaneous commands for minibuffer completion: Other commands for mct-minibuffer-mode

O
Overview of features: Overview of MCT

S
Sample configuration: Sample setup

Jump to:   A   C   E   I   K   M   O   S