README.org (64946B)
1 #+title: consult.el - Consulting completing-read 2 #+author: Daniel Mendler 3 #+language: en 4 #+export_file_name: consult.texi 5 #+texinfo_dir_category: Emacs misc features 6 #+texinfo_dir_title: Consult: (consult). 7 #+texinfo_dir_desc: Useful commands built on completing-read. 8 9 #+html: <a href="https://www.gnu.org/software/emacs/"><img alt="GNU Emacs" src="https://github.com/minad/corfu/blob/screenshots/emacs.svg?raw=true"/></a> 10 #+html: <a href="https://elpa.gnu.org/packages/consult.html"><img alt="GNU ELPA" src="https://elpa.gnu.org/packages/consult.svg"/></a> 11 #+html: <a href="https://elpa.gnu.org/devel/consult.html"><img alt="GNU-devel ELPA" src="https://elpa.gnu.org/devel/consult.svg"/></a> 12 #+html: <a href="https://melpa.org/#/consult"><img alt="MELPA" src="https://melpa.org/packages/consult-badge.svg"/></a> 13 #+html: <a href="https://stable.melpa.org/#/consult"><img alt="MELPA Stable" src="https://stable.melpa.org/packages/consult-badge.svg"/></a> 14 15 Consult provides search and navigation commands based on the Emacs completion 16 function [[https://www.gnu.org/software/emacs/manual/html_node/elisp/Minibuffer-Completion.html][completing-read]]. Completion allows you to quickly select an item from a 17 list of candidates. Consult offers asynchronous and interactive =consult-grep= and 18 =consult-ripgrep= commands, and the line-based search command =consult-line=. 19 Furthermore Consult provides an advanced buffer switching command =consult-buffer= 20 to switch between buffers, recently opened files, bookmarks and buffer-like 21 candidates from other sources. Some of the Consult commands are enhanced 22 versions of built-in Emacs commands. For example the command =consult-imenu= 23 presents a flat list of the Imenu with [[#live-previews][live preview]], [[#narrowing-and-grouping][grouping and narrowing]]. 24 Please take a look at the [[#available-commands][full list of commands]]. 25 26 Consult is fully compatible with completion systems centered around the standard 27 Emacs =completing-read= API, notably the default completion system, [[https://github.com/minad/vertico][Vertico]], [[https://github.com/protesilaos/mct][Mct]], 28 and [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Icomplete.html][Icomplete]]. 29 30 This package keeps the completion system specifics to a minimum. The ability of 31 the Consult commands to work well with arbitrary completion systems is one of 32 the main advantages of the package. Consult fits well into existing setups and 33 it helps you to create a full completion environment out of small and 34 independent components. 35 36 You can combine the complementary packages [[https://github.com/minad/marginalia/][Marginalia]], [[https://github.com/oantolin/embark/][Embark]] and [[https://github.com/oantolin/orderless][Orderless]] with 37 Consult. Marginalia enriches the completion display with annotations, e.g., 38 documentation strings or file information. The versatile Embark package provides 39 local actions, comparable to a context menu. These actions operate on the 40 selected candidate in the minibuffer or at point in normal buffers. For example, 41 when selecting from a list of files, Embark offers an action to delete the file. 42 Additionally Embark offers a facility to collect completion candidates in a 43 collect buffer. The section [[#embark-integration][Embark integration]] documents in greater detail how 44 Consult and Embark work together. 45 46 #+toc: headlines 8 47 48 * Screenshots :noexport: 49 50 #+caption: consult-grep 51 [[https://github.com/minad/consult/blob/screenshots/consult-grep.gif?raw=true]] 52 Fig. 1: Command =consult-git-grep= 53 54 #+caption: consult-imenu 55 [[https://github.com/minad/consult/blob/screenshots/consult-imenu.png?raw=true]] 56 Fig. 2: Command =consult-imenu= 57 58 #+caption: consult-line 59 [[https://github.com/minad/consult/blob/screenshots/consult-line.png?raw=true]] 60 Fig. 3: Command =consult-line= 61 62 * Available commands 63 :properties: 64 :custom_id: available-commands 65 :description: Navigation, search, editing commands and more 66 :end: 67 #+cindex: commands 68 69 Most Consult commands follow the meaningful naming scheme =consult-<thing>=. 70 Many commands implement a little known but convenient Emacs feature called 71 "future history", which guesses what input the user wants. At a command prompt 72 type =M-n= and typically Consult will insert the symbol or thing at point into 73 the input. 74 75 *TIP:* If you have [[https://github.com/minad/marginalia][Marginalia]] annotators activated, type =M-x ^consult= to see 76 all Consult commands with their abbreviated description. Alternatively, type 77 =C-h a ^consult= to get an overview of all Consult variables and functions with 78 their descriptions. 79 80 ** Virtual Buffers 81 :properties: 82 :description: Buffers, bookmarks and recent files 83 :end: 84 #+cindex: virtual buffers 85 86 #+findex: consult-buffer 87 #+findex: consult-buffer-other-window 88 #+findex: consult-buffer-other-frame 89 #+findex: consult-project-buffer 90 #+findex: consult-recent-file 91 #+findex: consult-bookmark 92 - =consult-buffer= (=-other-window=, =-other-frame=): Enhanced version 93 of =switch-to-buffer= with support for virtual buffers. Supports live preview 94 of buffers and narrowing to the virtual buffer types. You can type =f SPC= in 95 order to narrow to recent files. Press =SPC= to show ephemeral buffers. 96 Supported narrowing keys: 97 - b Buffers 98 - SPC Hidden buffers 99 - * Modified buffers 100 - f Files (Requires =recentf-mode=) 101 - r File registers 102 - m Bookmarks 103 - p Project 104 - Custom [[#multiple-sources][other sources]] configured in =consult-buffer-sources=. 105 - =consult-project-buffer=: Variant of =consult-buffer= restricted to buffers and 106 recent files of the current project. You can add custom sources to 107 =consult-project-buffer-sources=. The command may prompt you for a project if 108 you invoke it from outside a project. 109 - =consult-bookmark=: Select or create bookmark. To select bookmarks you might use the 110 =consult-buffer= as an alternative, which can include a bookmark virtual buffer 111 source. Note that =consult-bookmark= supports preview of bookmarks and 112 narrowing. 113 - =consult-recent-file=: Select from recent files with preview. 114 You might prefer the powerful =consult-buffer= instead, which can include 115 recent files as a virtual buffer source. The =recentf-mode= enables tracking of 116 recent files. 117 118 ** Editing 119 :properties: 120 :description: Commands useful for editing 121 :end: 122 #+cindex: editing 123 124 #+findex: consult-yank-pop 125 #+findex: consult-yank-from-kill-ring 126 #+findex: consult-yank-replace 127 #+findex: consult-kmacro 128 - =consult-yank-from-kill-ring=: Enhanced version of =yank= to select an item 129 from the =kill-ring=. The selected text previewed as overlay in the buffer. 130 - =consult-yank-pop=: Enhanced version of =yank-pop= with DWIM-behavior, which 131 either replaces the last =yank= by cycling through the =kill-ring=, or if there 132 has not been a last =yank= consults the =kill-ring=. The selected text previewed 133 as overlay in the buffer. 134 - =consult-yank-replace=: Like =consult-yank-pop=, but always replaces the last 135 =yank= with an item from the =kill-ring=. 136 - =consult-kmacro=: Select macro from the macro ring and execute it. 137 138 ** Register 139 :properties: 140 :description: Searching through registers and fast access 141 :end: 142 #+cindex: register 143 144 #+findex: consult-register 145 #+findex: consult-register-load 146 #+findex: consult-register-store 147 #+findex: consult-register-format 148 #+findex: consult-register-window 149 - =consult-register=: Select from list of registers. The command 150 supports narrowing to register types and preview of marker positions. This 151 command is useful to search the register contents. For quick access use the 152 commands =consult-register-load=, =consult-register-store= or the built-in Emacs 153 register commands. 154 - =consult-register-format=: Set =register-preview-function= to this function for 155 an enhanced register formatting. See the [[#use-package-example][example configuration]]. 156 - =consult-register-window=: Replace =register-preview= with this function for a 157 better register window. See the [[#use-package-example][example configuration]]. 158 - =consult-register-load=: Utility command to quickly load a register. 159 The command either jumps to the register value or inserts it. 160 - =consult-register-store=: Improved UI to store registers depending on the current 161 context with an action menu. With an active region, store/append/prepend the 162 contents, optionally deleting the region when a prefix argument is given. 163 With a numeric prefix argument, store/add the number. Otherwise store point, 164 frameset, window or kmacro. Usage examples: 165 * =M-' x=: If no region is active, store point in register =x=. 166 If a region is active, store the region in register =x=. 167 * =M-' M-w x=: Store window configuration in register =x=. 168 * =C-u 100 M-' x=: Store number in register =x=. 169 170 ** Navigation 171 :properties: 172 :description: Mark rings, outlines and imenu 173 :end: 174 #+cindex: navigation 175 176 #+findex: consult-goto-line 177 #+findex: consult-mark 178 #+findex: consult-global-mark 179 #+findex: consult-outline 180 #+findex: consult-imenu 181 #+findex: consult-imenu-multi 182 - =consult-goto-line=: Jump to line number enhanced with live preview. 183 This is a drop-in replacement for =goto-line=. 184 - =consult-mark=: Jump to a marker in the =mark-ring=. Supports live 185 preview and recursive editing. 186 - =consult-global-mark=: Jump to a marker in the =global-mark-ring=. 187 Supports live preview and recursive editing. 188 - =consult-outline=: Jump to a heading of the outline. Supports narrowing 189 to a heading level, live preview and recursive editing. 190 - =consult-imenu=: Jump to imenu item in the current buffer. Supports 191 live preview, recursive editing and narrowing. 192 - =consult-imenu-multi=: Jump to imenu item in project buffers, with 193 the same major mode as the current buffer. Supports live preview, 194 recursive editing and narrowing. This feature has been inspired by 195 [[https://github.com/vspinu/imenu-anywhere][imenu-anywhere]]. 196 197 ** Search 198 :properties: 199 :description: Line search, grep and file search 200 :end: 201 #+cindex: search 202 203 #+findex: consult-line 204 #+findex: consult-line-multi 205 #+findex: consult-keep-lines 206 #+findex: consult-focus-lines 207 - =consult-line=: Enter search string and select from matching lines. 208 Supports live preview and recursive editing. The symbol at point and the 209 recent Isearch string are added to the "future history" and can be accessed 210 by pressing =M-n=. When =consult-line= is bound to the =isearch-mode-map= and 211 is invoked during a running Isearch, it will use the current Isearch string. 212 - =consult-line-multi=: Search dynamically across multiple buffers. By default 213 search across project buffers. If invoked with a prefix argument search across 214 all buffers. The candidates are computed on demand based on the input. The 215 command behaves like =consult-grep=, but operates on buffers instead of files. 216 - =consult-keep-lines=: Replacement for =keep/flush-lines= which uses the current 217 completion style for filtering the buffer. The function updates the buffer 218 while typing. In particular =consult-keep-lines= can narrow down an exported 219 Embark collect buffer further, relying on the same completion filtering as 220 ~completing-read~. If the input begins with the negation operator, i.e., ~! SPC~, 221 the filter matches the complement. If a region is active, the region restricts 222 the filtering. 223 - =consult-focus-lines=: Temporarily hide lines by filtering them using the 224 current completion style. Call with =C-u= prefix argument in order to show the 225 hidden lines again. If the input begins with the negation operator, i.e., ~! 226 SPC~, the filter matches the complement. In contrast to =consult-keep-lines= this 227 function does not edit the buffer. If a region is active, the region restricts 228 the filtering. 229 230 ** Grep and Find 231 :properties: 232 :description: Searching through the filesystem 233 :end: 234 #+cindex: grep 235 #+cindex: find 236 #+cindex: locate 237 238 #+findex: consult-grep 239 #+findex: consult-ripgrep 240 #+findex: consult-git-grep 241 #+findex: consult-find 242 #+findex: consult-locate 243 - =consult-grep=, =consult-ripgrep=, =consult-git-grep=: Search for regular expression 244 in files. Consult invokes Grep asynchronously, while you enter the search 245 term. After at least =consult-async-min-input= characters, the search gets 246 started. Consult splits the input string into two parts, if the first 247 character is a punctuation character, like =#=. For example 248 =#regexps#filter-string=, is split at the second =#=. The string =regexps= is passed 249 to Grep. Note that Consult transforms Emacs regular expressions to expressions 250 understand by the search program. Always use Emacs regular expressions at the 251 prompt. If you enter multiple regular expressions separated by space only 252 lines matching all regular expressions are shown. In order to match space 253 literally, escape the space with a backslash. The =filter-string= is passed to 254 the /fast/ Emacs filtering to further narrow down the list of matches. This is 255 particularly useful if you are using an advanced completion style like 256 orderless. =consult-grep= supports preview. If the =consult-project-function= 257 returns non-nil, =consult-grep= searches the current project directory. 258 Otherwise the =default-directory= is searched. If =consult-grep= is invoked 259 with prefix argument =C-u M-s g=, you can specify one or more comma-separated files 260 and directories manually. 261 - =consult-find=, =consult-locate=: Find file by matching the path against a regexp. 262 Like for =consult-grep=, either the project root or the current directory is the 263 root directory for the search. The input string is treated similarly to 264 =consult-grep=, where the first part is passed to find, and the second part is 265 used for Emacs filtering. Prefix arguments to =consult-find= work just like those 266 for the consult grep commands. 267 268 ** Compilation 269 :properties: 270 :description: Jumping to references and compilation errors 271 :end: 272 #+cindex: compilation errors 273 274 #+findex: consult-compile-error 275 #+findex: consult-flymake 276 #+findex: consult-xref 277 - =consult-compile-error=: Jump to a compilation error. Supports live preview 278 narrowing and recursive editing. 279 - =consult-flymake=: Jump to Flymake diagnostic. Supports live preview and 280 recursive editing. The command supports narrowing. Press =e SPC=, =w SPC=, =n SPC= 281 to only show errors, warnings and notes respectively. 282 - =consult-xref=: Integration with xref. This function can be set as 283 =xref-show-xrefs-function= and =xref-show-definitions-function=. 284 285 ** Histories 286 :properties: 287 :description: Navigating histories 288 :end: 289 #+cindex: history 290 291 #+findex: consult-complex-command 292 #+findex: consult-history 293 #+findex: consult-isearch-history 294 - =consult-complex-command=: Select a command from the 295 =command-history=. This command is a =completing-read= version of 296 =repeat-complex-command= and is also a replacement for the =command-history= 297 command from chistory.el. 298 - =consult-history=: Insert a string from the current buffer history, for example 299 the Eshell or Comint history. You can also invoke this command from the 300 minibuffer. In that case =consult-history= uses the history stored in the 301 =minibuffer-history-variable=. If you prefer =completion-at-point=, take a look at 302 =cape-history= from the [[https://github.com/minad/cape][Cape]] package. 303 - =consult-isearch-history=: During an Isearch session, this command picks a 304 search string from history and continues the search with the newly selected 305 string. Outside of Isearch, the command allows you to pick a string from the 306 history and starts a new Isearch. =consult-isearch-history= acts as a drop-in 307 replacement for =isearch-edit-string=. 308 309 ** Modes 310 :properties: 311 :description: Toggling minor modes and executing commands 312 :end: 313 #+cindex: minor mode 314 #+cindex: major mode 315 316 #+findex: consult-minor-mode-menu 317 #+findex: consult-mode-command 318 - =consult-minor-mode-menu=: Enable/disable minor mode. Supports 319 narrowing to on/off/local/global modes by pressing =i/o/l/g SPC= 320 respectively. 321 - =consult-mode-command=: Run a command from the currently active minor or major 322 modes. Supports narrowing to local-minor/global-minor/major mode via the keys 323 =l/g/m=. 324 325 ** Org Mode 326 :properties: 327 :description: Org-specific commands 328 :end: 329 330 #+findex: consult-org-heading 331 #+findex: consult-org-agenda 332 - =consult-org-heading=: Similar to =consult-outline=, for Org 333 buffers. Supports narrowing by heading level, priority and TODO 334 state, as well as live preview and recursive editing. 335 - =consult-org-agenda=: Jump to an agenda heading. Supports 336 narrowing by heading level, priority and TODO state, as well as 337 live preview and recursive editing. 338 ** Help 339 :properties: 340 :description: Searching through help 341 :end: 342 343 #+findex: consult-info 344 #+findex: consult-man 345 - =consult-man=: Find Unix man page, via Unix =apropos= or =man -k=. =consult-man= opens 346 the selected man page using the Emacs =man= command. 347 - =consult-info=: Full text search through info pages. If the command is invoked 348 from within an ~*info*~ buffer, it will search through the current manual. You 349 may want to create your own commands which search through a predefined set of 350 info pages, for example: 351 #+begin_src emacs-lisp 352 (defun consult-info-emacs () 353 "Search through Emacs info pages." 354 (interactive) 355 (consult-info "emacs" "efaq" "elisp" "cl" "compat")) 356 357 (defun consult-info-org () 358 "Search through the Org info page." 359 (interactive) 360 (consult-info "org")) 361 362 (defun consult-info-completion () 363 "Search through completion info pages." 364 (interactive) 365 (consult-info "vertico" "consult" "marginalia" "orderless" "embark" 366 "corfu" "cape" "tempel")) 367 #+end_src 368 369 ** Miscellaneous 370 :properties: 371 :description: Various other useful commands 372 :end: 373 374 #+findex: consult-completion-in-region 375 #+findex: consult-theme 376 #+findex: consult-preview-at-point 377 #+findex: consult-preview-at-point-mode 378 - =consult-theme=: Select a theme and disable all currently enabled themes. 379 Supports live preview of the theme while scrolling through the candidates. 380 - =consult-preview-at-point= and =consult-preview-at-point-mode=: Command and minor 381 mode which previews the candidate at point in the =*Completions*= buffer. This 382 mode is relevant if you use [[https://git.sr.ht/~protesilaos/mct][Mct]] or the default =*Completions*= UI. 383 - =consult-completion-in-region=: In case you don't use [[https://github.com/minad/corfu][Corfu]] as your in-buffer 384 completion UI, this function can be set as =completion-in-region-function=. Then 385 your minibuffer completion UI (e.g., Vertico or Icomplete) will be used for 386 =completion-at-point=. 387 #+begin_src emacs-lisp 388 ;; Use `consult-completion-in-region' if Vertico is enabled. 389 ;; Otherwise use the default `completion--in-region' function. 390 (setq completion-in-region-function 391 (lambda (&rest args) 392 (apply (if vertico-mode 393 #'consult-completion-in-region 394 #'completion--in-region) 395 args))) 396 #+end_src 397 Instead of =consult-completion-in-region=, you may prefer to see the 398 completions directly in the buffer as a small popup. In that case, I recommend 399 either the [[https://github.com/minad/corfu][Corfu]] or the [[https://github.com/company-mode/company-mode][Company]] package. There is a technical limitation of 400 =consult-completion-in-region= in combination with Lsp-mode or Eglot. The Lsp 401 server relies on the input at point, in order to generate refined candidate 402 strings. Since the completion is transferred from the original buffer to the 403 minibuffer, the server does not receive the updated input. LSP completion 404 works with Corfu or Company though, which perform the completion directly in 405 the original buffer. 406 407 * Special features 408 :properties: 409 :description: Enhancements over built-in `completing-read' 410 :end: 411 412 Consult enhances =completing-read= with live previews of candidates, additional 413 narrowing capabilities to candidate groups and asynchronously generated 414 candidate lists. The internal =consult--read= function, which is used by most 415 Consult commands, is a thin wrapper around =completing-read= and provides the 416 special functionality. In order to support multiple candidate sources there 417 exists the high-level function =consult--multi=. The architecture of Consult 418 allows it to work with different completion systems in the backend, while still 419 offering advanced features. 420 421 ** Live previews 422 :properties: 423 :description: Preview the currently selected candidate 424 :custom_id: live-previews 425 :end: 426 #+cindex: preview 427 428 Some Consult commands support live previews. For example when you scroll through 429 the items of =consult-line=, the buffer will scroll to the corresponding position. 430 It is possible to jump back and forth between the minibuffer and the buffer to 431 perform recursive editing while the search is ongoing. 432 433 Consult enables previews by default. You can disable them by adjusting the 434 =consult-preview-key= variable. Furthermore it is possible to specify keybindings 435 which trigger the preview manually as shown in the [[#use-package-example][example configuration]]. The 436 default setting of =consult-preview-key= is =any= which means that Consult triggers 437 the preview /immediately/ on any key press when the selected candidate changes. 438 You can configure each command individually with its own =:preview-key=. The 439 following settings are possible: 440 441 - Automatic and immediate ='any= 442 - Automatic and delayed =(list :debounce 0.5 'any)= 443 - Manual and immediate ="M-."= 444 - Manual and delayed =(list :debounce 0.5 "M-.")= 445 - Disabled =nil= 446 447 A safe recommendation is to leave automatic immediate previews enabled in 448 general and disable the automatic preview only for commands where the preview 449 may be expensive due to file loading. Internally, Consult uses the 450 value of =this-command= to determine the =:preview-key= 451 customized. This means that if you wrap a =consult-*= command within 452 your own function or command, you will also need to add the name of 453 /your custom command/ to the =consult-customize= call in order for it 454 to be considered. 455 456 #+begin_src emacs-lisp 457 (consult-customize 458 consult-ripgrep consult-git-grep consult-grep 459 consult-bookmark consult-recent-file consult-xref 460 consult--source-bookmark consult--source-file-register 461 consult--source-recent-file consult--source-project-recent-file 462 ;; my/command-wrapping-consult ;; disable auto previews inside my command 463 :preview-key '(:debounce 0.4 any) ;; Option 1: Delay preview 464 ;; :preview-key "M-.") ;; Option 2: Manual preview 465 #+end_src 466 467 In this case one may wonder what the difference is between using an Embark 468 action on the current candidate in comparison to a manually triggered preview. 469 The main difference is that the files opened by manual preview are closed again 470 after the completion session. Furthermore during preview some functionality is 471 disabled to improve the performance, see for example the customization variables 472 =consult-preview-allowed-hooks= and =consult-preview-variables=. Files larger than 473 =consult-preview-raw-size= are previewed literally without syntax highlighting and 474 without changing the major mode. Delaying the preview is also useful for 475 =consult-theme=, since the theme preview is slow. The delay results in a smoother 476 UI experience. 477 478 #+begin_src emacs-lisp 479 ;; Preview on any key press, but delay 0.5s 480 (consult-customize consult-theme :preview-key '(:debounce 0.5 any)) 481 ;; Preview immediately on M-., on up/down after 0.5s, on any other key after 1s 482 (consult-customize consult-theme 483 :preview-key 484 '("M-." 485 :debounce 0.5 "<up>" "<down>" 486 :debounce 1 any)) 487 #+end_src 488 489 ** Narrowing and grouping 490 :properties: 491 :description: Restricting the completion to a candidate group 492 :custom_id: narrowing-and-grouping 493 :end: 494 #+cindex: narrowing 495 496 Consult has special support for candidate groups. If the completion UI supports 497 the grouping functionality, the UI separates the groups with thin lines and 498 shows group titles. Grouping is useful if the list of candidates consists of 499 candidates of multiple types or candidates from [[#multiple-sources][multiple sources]], like the 500 =consult-buffer= command, which shows both buffers and recently opened files. Note 501 that you can disable the group titles by setting the =:group= property of the 502 corresponding command to nil using the =consult-customize= macro. 503 504 By entering a narrowing prefix or by pressing a narrowing key it is possible to 505 restrict the completion candidates to a certain candidate group. When you use 506 the =consult-buffer= command, you can enter the prefix =b SPC= to restrict list of 507 candidates to buffers only. If you press =DEL= afterwards, the full candidate list 508 will be shown again. Furthermore a narrowing prefix key and a widening key can 509 be configured which can be pressed to achieve the same effect, see the 510 configuration variables =consult-narrow-key= and =consult-widen-key=. 511 512 After pressing =consult-narrow-key=, the possible narrowing keys can be shown by 513 pressing =C-h=. When pressing =C-h= after some prefix key, the =prefix-help-command= 514 is invoked, which shows the keybinding help window by default. As a more compact 515 alternative, there is the =consult-narrow-help= command which can be bound to a 516 key, for example =?= or =C-h= in the =consult-narrow-map=, as shown in the [[#use-package-example][example 517 configuration]]. If [[https://github.com/justbur/emacs-which-key][which-key]] is installed, the narrowing keys are automatically 518 shown in the which-key window after pressing the =consult-narrow-key=. 519 520 ** Asynchronous search 521 :properties: 522 :description: Filtering asynchronously generated candidate lists 523 :end: 524 #+cindex: asynchronous search 525 526 Consult has support for asynchronous generation of candidate lists. This feature 527 is used for search commands like =consult-grep=, where the list of matches is 528 generated dynamically while the user is typing a regular expression. The grep 529 process is executed in the background. When modifying the regular expression, 530 the background process is terminated and a new process is started with the 531 modified regular expression. 532 533 The matches, which have been found, can then be narrowed using the installed 534 Emacs completion-style. This can be powerful if you are using for example the 535 =orderless= completion style. 536 537 This two-level filtering is possible by splitting the input string. Part of the 538 input string is treated as input to grep and part of the input is used for 539 filtering. There are multiple splitting styles available, configured in 540 ~consult-async-split-styles-alist~: =nil=, =comma=, =semicolon= and =perl=. The default 541 splitting style is configured with the variable ~consult-async-split-style~. 542 543 With the =comma= and =semicolon= splitting styles, the first word before the comma 544 or semicolon is passed to grep, the remaining string is used for filtering. The 545 =nil= splitting style does not perform any splitting, the whole input is passed to 546 grep. 547 548 The =perl= splitting style splits the input string at a punctuation character, 549 using a similar syntax as Perl regular expressions. 550 551 Examples: 552 553 - =#defun=: Search for "defun" using grep. 554 - =#consult embark=: Search for both "consult" and "embark" using grep in any order. 555 - =#first.*second=: Search for "first" followed by "second" using grep. 556 - =#\(consult\|embark\)=: Search for "consult" or "embark" using grep. Note the 557 usage of Emacs-style regular expressions. 558 - =#defun#consult=: Search for "defun" using grep, filter with the word 559 "consult". 560 - =/defun/consult=: It is also possible to use other punctuation 561 characters. 562 - =#to#=: Force searching for "to" using grep, since the grep pattern 563 must be longer than =consult-async-min-input= characters by default. 564 - =#defun -- --invert-match#=: Pass argument =--invert-match= to grep. 565 566 Asynchronous processes like =find= and =grep= create an error log buffer 567 =_*consult-async*= (note the leading space), which is useful for 568 troubleshooting. The prompt has a small indicator showing the process status: 569 570 - =:= the usual prompt colon, before input is provided. 571 - =*= with warning face, the process is running. 572 - =:= with success face, success, process exited with an error code of zero. 573 - =!= with error face, failure, process exited with a nonzero error code. 574 - =;= with error face, interrupted, for example if more input is provided. 575 576 ** Multiple sources 577 :properties: 578 :description: Combining candidates from different sources 579 :custom_id: multiple-sources 580 :end: 581 #+cindex: multiple sources 582 583 Multiple synchronous candidate sources can be combined. This feature is used by 584 the =consult-buffer= command to present buffer-like candidates in a single menu 585 for quick access. By default =consult-buffer= includes buffers, bookmarks, recent 586 files and project-specific buffers and files. It is possible to configure the 587 list of sources via the =consult-buffer-sources= variable. Arbitrary custom 588 sources can be defined. 589 590 As an example, the bookmark source is defined as follows: 591 592 #+begin_src emacs-lisp 593 (defvar consult--source-bookmark 594 `(:name "Bookmark" 595 :narrow ?m 596 :category bookmark 597 :face consult-bookmark 598 :history bookmark-history 599 :items ,#'bookmark-all-names 600 :action ,#'consult--bookmark-action)) 601 #+end_src 602 603 Required source fields: 604 - =:category= Completion category. 605 - =:items= List of strings to select from or function returning list of strings. 606 A list of cons cells is not supported. 607 608 Optional source fields: 609 - =:name= Name of the source, used for narrowing, group titles and annotations. 610 - =:narrow= Narrowing character or =(character . string)= pair. 611 - =:preview-key= Preview key or keys which trigger preview. 612 - =:enabled= Function which must return t if the source is enabled. 613 - =:hidden= When t candidates of this source are hidden by default. 614 - =:face= Face used for highlighting the candidates. 615 - =:annotate= Annotation function called for each candidate, returns string. 616 - =:history= Name of history variable to add selected candidate. 617 - =:default= Must be t if the first item of the source is the default value. 618 - =:action= Function called with the selected candidate. 619 - =:new= Function called with new candidate name, only if =:require-match= is nil. 620 - =:state= State constructor for the source, must return the state function. 621 - Other source fields can be added specifically to the use case. 622 623 The =:state= and =:action= fields of the sources deserve a longer explanation. The 624 =:action= function takes a single argument and is only called after selection with 625 the selected candidate, if the selection has not been aborted. This 626 functionality is provided for convenience and easy definition of sources. The 627 =:state= field is more general. The =:state= function is a constructor function 628 without arguments, which can perform some setup necessary for the preview. It 629 must return a closure which takes an ACTION and a CANDIDATE argument. See the 630 docstring of =consult--with-preview= for more details about the ACTION argument. 631 632 By default, =consult-buffer= previews buffers, bookmarks and files. Loading recent 633 files or bookmarks can result in expensive operations. However it is possible to 634 configure a manual preview as follows. 635 636 #+begin_src emacs-lisp 637 (consult-customize 638 consult--source-bookmark consult--source-file-register 639 consult--source-recent-file consult--source-project-recent-file 640 :preview-key "M-.") 641 #+end_src 642 643 Sources can be added directly to the =consult-buffer-source= list for convenience. 644 For example views/perspectives can be added to the list of virtual buffers from 645 a library like [[https://github.com/minad/bookmark-view/][bookmark-view]]. 646 647 #+begin_src emacs-lisp 648 ;; Configure new bookmark-view source 649 (add-to-list 'consult-buffer-sources 650 (list :name "View" 651 :narrow ?v 652 :category 'bookmark 653 :face 'font-lock-keyword-face 654 :history 'bookmark-view-history 655 :action #'consult--bookmark-action 656 :items #'bookmark-view-names) 657 'append) 658 659 ;; Modify bookmark source, such that views are hidden 660 (setq consult--source-bookmark 661 (plist-put 662 consult--source-bookmark :items 663 (lambda () 664 (bookmark-maybe-load-default-file) 665 (mapcar #'car 666 (seq-remove (lambda (x) 667 (eq #'bookmark-view-handler 668 (alist-get 'handler (cdr x)))) 669 bookmark-alist))))) 670 #+end_src 671 672 Another useful source lists all Org buffers and lets you create new ones. One 673 can create similar sources for other major modes, e.g., for Eshell. 674 675 #+begin_src emacs-lisp 676 (defvar org-source 677 (list :name "Org Buffer" 678 :category 'buffer 679 :narrow ?o 680 :face 'consult-buffer 681 :history 'buffer-name-history 682 :state #'consult--buffer-state 683 :new 684 (lambda (name) 685 (with-current-buffer (get-buffer-create name) 686 (insert "#+title: " name "\n\n") 687 (org-mode) 688 (consult--buffer-action (current-buffer)))) 689 :items 690 (lambda () 691 (mapcar #'buffer-name 692 (seq-filter 693 (lambda (x) 694 (eq (buffer-local-value 'major-mode x) 'org-mode)) 695 (buffer-list)))))) 696 697 (add-to-list 'consult-buffer-sources 'org-source 'append) 698 #+end_src 699 700 For more details, see the documentation of =consult-buffer= and of the 701 internal =consult--multi= API. The =consult--multi= function can be used to 702 create new multi-source commands, but is part of the internal API as of now, 703 since some details may still change. 704 705 ** Embark integration 706 :properties: 707 :description: Actions, Grep/Occur-buffer export 708 :custom_id: embark-integration 709 :end: 710 #+cindex: embark 711 712 *NOTE*: Install the =embark-consult= package from MELPA, which provides 713 Consult-specific Embark actions and the Occur buffer export. 714 715 Embark is a versatile package which offers context dependent actions, comparable 716 to a context menu. See the [[https://github.com/oantolin/embark][Embark manual]] for an extensive description of its 717 capabilities. 718 719 Actions are commands which can operate on the currently selected candidate (or 720 target in Embark terminology). When completing files, for example the 721 =delete-file= command is offered. With Embark you can execute arbitrary commands 722 on the currently selected candidate via =M-x=. 723 724 Furthermore Embark provides the =embark-collect= command, which collects 725 candidates and presents them in an Embark collect buffer, where further actions 726 can be applied to them. A related feature is the =embark-export= command, which 727 exports candidate lists to a buffer of a special type. For example in the case 728 of file completion, a Dired buffer is opened. 729 730 In the context of Consult, particularly exciting is the possibility to export 731 the matching lines from =consult-line=, =consult-outline=, =consult-mark= and 732 =consult-global-mark=. The matching lines are exported to an Occur buffer where 733 they can be edited via the =occur-edit-mode= (press key =e=). Similarly, Embark 734 supports exporting the matches found by =consult-grep=, =consult-ripgrep= and 735 =consult-git-grep= to a Grep buffer, where the matches across files can be edited, 736 if the [[https://github.com/mhayashi1120/Emacs-wgrep][wgrep]] package is installed. These three workflows are symmetric. 737 738 + =consult-line= -> =embark-export= to =occur-mode= buffer -> =occur-edit-mode= for editing of matches in buffer. 739 + =consult-grep= -> =embark-export= to =grep-mode= buffer -> =wgrep= for editing of all matches. 740 + =consult-find= -> =embark-export= to =dired-mode= buffer -> =wdired-change-to-wdired-mode= for editing. 741 742 * Configuration 743 :properties: 744 :description: Example configuration and customization variables 745 :end: 746 747 Consult can be installed from [[https://elpa.gnu.org/packages/consult.html][ELPA]] or [[https://melpa.org/#/consult][MELPA]] via the Emacs built-in package 748 manager. Alternatively it can be directly installed from the development 749 repository via other non-standard package managers. 750 751 There is the [[https://github.com/minad/consult/wiki][Consult wiki]], where additional configuration examples can be 752 contributed. 753 754 *IMPORTANT:* It is strongly recommended that you enable [[https://www.gnu.org/software/emacs/manual/html_node/elisp/Lexical-Binding.html][lexical binding]] in your 755 configuration. Consult relies on lambdas and lexical closures. For this reason 756 many Consult-related snippets require lexical binding. 757 758 ** Use-package example 759 :properties: 760 :description: Configuration example based on use-package 761 :custom_id: use-package-example 762 :end: 763 #+cindex: use-package 764 765 The Consult package only provides commands and does not add any keybindings or 766 modes. Therefore the package is non-intrusive but requires a little setup 767 effort. In order to use the Consult commands, it is advised to add keybindings 768 for commands which are accessed often. Rarely used commands can be invoked via 769 =M-x=. Feel free to only bind the commands you consider useful to your workflow. 770 The configuration shown here relies on the =use-package= macro, which is a 771 convenient tool to manage package configurations. 772 773 *NOTE:* There is the [[https://github.com/minad/consult/wiki][Consult wiki]], where you can contribute additional 774 configuration examples. 775 776 #+begin_src emacs-lisp 777 ;; Example configuration for Consult 778 (use-package consult 779 ;; Replace bindings. Lazily loaded due by `use-package'. 780 :bind (;; C-c bindings in `mode-specific-map' 781 ("C-c M-x" . consult-mode-command) 782 ("C-c h" . consult-history) 783 ("C-c k" . consult-kmacro) 784 ("C-c m" . consult-man) 785 ("C-c i" . consult-info) 786 ([remap Info-search] . consult-info) 787 ;; C-x bindings in `ctl-x-map' 788 ("C-x M-:" . consult-complex-command) ;; orig. repeat-complex-command 789 ("C-x b" . consult-buffer) ;; orig. switch-to-buffer 790 ("C-x 4 b" . consult-buffer-other-window) ;; orig. switch-to-buffer-other-window 791 ("C-x 5 b" . consult-buffer-other-frame) ;; orig. switch-to-buffer-other-frame 792 ("C-x r b" . consult-bookmark) ;; orig. bookmark-jump 793 ("C-x p b" . consult-project-buffer) ;; orig. project-switch-to-buffer 794 ;; Custom M-# bindings for fast register access 795 ("M-#" . consult-register-load) 796 ("M-'" . consult-register-store) ;; orig. abbrev-prefix-mark (unrelated) 797 ("C-M-#" . consult-register) 798 ;; Other custom bindings 799 ("M-y" . consult-yank-pop) ;; orig. yank-pop 800 ;; M-g bindings in `goto-map' 801 ("M-g e" . consult-compile-error) 802 ("M-g f" . consult-flymake) ;; Alternative: consult-flycheck 803 ("M-g g" . consult-goto-line) ;; orig. goto-line 804 ("M-g M-g" . consult-goto-line) ;; orig. goto-line 805 ("M-g o" . consult-outline) ;; Alternative: consult-org-heading 806 ("M-g m" . consult-mark) 807 ("M-g k" . consult-global-mark) 808 ("M-g i" . consult-imenu) 809 ("M-g I" . consult-imenu-multi) 810 ;; M-s bindings in `search-map' 811 ("M-s d" . consult-find) 812 ("M-s D" . consult-locate) 813 ("M-s g" . consult-grep) 814 ("M-s G" . consult-git-grep) 815 ("M-s r" . consult-ripgrep) 816 ("M-s l" . consult-line) 817 ("M-s L" . consult-line-multi) 818 ("M-s k" . consult-keep-lines) 819 ("M-s u" . consult-focus-lines) 820 ;; Isearch integration 821 ("M-s e" . consult-isearch-history) 822 :map isearch-mode-map 823 ("M-e" . consult-isearch-history) ;; orig. isearch-edit-string 824 ("M-s e" . consult-isearch-history) ;; orig. isearch-edit-string 825 ("M-s l" . consult-line) ;; needed by consult-line to detect isearch 826 ("M-s L" . consult-line-multi) ;; needed by consult-line to detect isearch 827 ;; Minibuffer history 828 :map minibuffer-local-map 829 ("M-s" . consult-history) ;; orig. next-matching-history-element 830 ("M-r" . consult-history)) ;; orig. previous-matching-history-element 831 832 ;; Enable automatic preview at point in the *Completions* buffer. This is 833 ;; relevant when you use the default completion UI. 834 :hook (completion-list-mode . consult-preview-at-point-mode) 835 836 ;; The :init configuration is always executed (Not lazy) 837 :init 838 839 ;; Optionally configure the register formatting. This improves the register 840 ;; preview for `consult-register', `consult-register-load', 841 ;; `consult-register-store' and the Emacs built-ins. 842 (setq register-preview-delay 0.5 843 register-preview-function #'consult-register-format) 844 845 ;; Optionally tweak the register preview window. 846 ;; This adds thin lines, sorting and hides the mode line of the window. 847 (advice-add #'register-preview :override #'consult-register-window) 848 849 ;; Use Consult to select xref locations with preview 850 (setq xref-show-xrefs-function #'consult-xref 851 xref-show-definitions-function #'consult-xref) 852 853 ;; Configure other variables and modes in the :config section, 854 ;; after lazily loading the package. 855 :config 856 857 ;; Optionally configure preview. The default value 858 ;; is 'any, such that any key triggers the preview. 859 ;; (setq consult-preview-key 'any) 860 ;; (setq consult-preview-key "M-.") 861 ;; (setq consult-preview-key '("S-<down>" "S-<up>")) 862 ;; For some commands and buffer sources it is useful to configure the 863 ;; :preview-key on a per-command basis using the `consult-customize' macro. 864 (consult-customize 865 consult-theme :preview-key '(:debounce 0.2 any) 866 consult-ripgrep consult-git-grep consult-grep 867 consult-bookmark consult-recent-file consult-xref 868 consult--source-bookmark consult--source-file-register 869 consult--source-recent-file consult--source-project-recent-file 870 ;; :preview-key "M-." 871 :preview-key '(:debounce 0.4 any)) 872 873 ;; Optionally configure the narrowing key. 874 ;; Both < and C-+ work reasonably well. 875 (setq consult-narrow-key "<") ;; "C-+" 876 877 ;; Optionally make narrowing help available in the minibuffer. 878 ;; You may want to use `embark-prefix-help-command' or which-key instead. 879 ;; (define-key consult-narrow-map (vconcat consult-narrow-key "?") #'consult-narrow-help) 880 881 ;; By default `consult-project-function' uses `project-root' from project.el. 882 ;; Optionally configure a different project root function. 883 ;;;; 1. project.el (the default) 884 ;; (setq consult-project-function #'consult--default-project--function) 885 ;;;; 2. vc.el (vc-root-dir) 886 ;; (setq consult-project-function (lambda (_) (vc-root-dir))) 887 ;;;; 3. locate-dominating-file 888 ;; (setq consult-project-function (lambda (_) (locate-dominating-file "." ".git"))) 889 ;;;; 4. projectile.el (projectile-project-root) 890 ;; (autoload 'projectile-project-root "projectile") 891 ;; (setq consult-project-function (lambda (_) (projectile-project-root))) 892 ;;;; 5. No project support 893 ;; (setq consult-project-function nil) 894 ) 895 #+end_src 896 897 ** Custom variables 898 :properties: 899 :description: Short description of all customization settings 900 :end: 901 #+cindex: customization 902 903 *TIP:* If you have [[https://github.com/minad/marginalia][Marginalia]] installed, type =M-x customize-variable RET 904 ^consult= to see all Consult-specific customizable variables with their current 905 values and abbreviated description. Alternatively, type =C-h a ^consult= to get 906 an overview of all Consult variables and functions with their descriptions. 907 908 | Variable | Description | 909 |----------------------------------+-------------------------------------------------------| 910 | consult-after-jump-hook | Functions to call after jumping to a location | 911 | consult-async-input-debounce | Input debounce for asynchronous commands | 912 | consult-async-input-throttle | Input throttle for asynchronous commands | 913 | consult-async-min-input | Minimum numbers of letters needed for async process | 914 | consult-async-refresh-delay | Refresh delay for asynchronous commands | 915 | consult-async-split-style | Splitting style used for async commands | 916 | consult-async-split-styles-alist | Available splitting styles used for async commands | 917 | consult-bookmark-narrow | Narrowing configuration for =consult-bookmark= | 918 | consult-buffer-filter | Filter for =consult-buffer= | 919 | consult-buffer-sources | List of virtual buffer sources | 920 | consult-find-args | Command line arguments for find | 921 | consult-fontify-max-size | Buffers larger than this limit are not fontified | 922 | consult-fontify-preserve | Preserve fontification for line-based commands. | 923 | consult-git-grep-args | Command line arguments for git-grep | 924 | consult-goto-line-numbers | Show line numbers for =consult-goto-line= | 925 | consult-grep-max-columns | Maximal number of columns of the matching lines | 926 | consult-grep-args | Command line arguments for grep | 927 | consult-imenu-config | Mode-specific configuration for =consult-imenu= | 928 | consult-line-numbers-widen | Show absolute line numbers when narrowing is active. | 929 | consult-line-start-from-top | Start the =consult-line= search from the top | 930 | consult-locate-args | Command line arguments for locate | 931 | consult-man-args | Command line arguments for man | 932 | consult-mode-command-filter | Filter for =consult-mode-command= | 933 | consult-mode-histories | Mode-specific history variables | 934 | consult-narrow-key | Narrowing prefix key during completion | 935 | consult-point-placement | Placement of the point when jumping to matches | 936 | consult-preview-key | Keys which triggers preview | 937 | consult-preview-allowed-hooks | List of =find-file= hooks to enable during preview | 938 | consult-preview-excluded-files | Regexps matched against file names during preview | 939 | consult-preview-max-count | Maximum number of files to keep open during preview | 940 | consult-preview-max-size | Files larger than this size are not previewed | 941 | consult-preview-raw-size | Files larger than this size are previewed in raw form | 942 | consult-preview-variables | Alist of variables to bind during preview | 943 | consult-project-buffer-sources | List of virtual project buffer sources | 944 | consult-project-function | Function which returns current project root | 945 | consult-register-prefix | Prefix string for register keys during completion | 946 | consult-ripgrep-args | Command line arguments for ripgrep | 947 | consult-themes | List of themes to be presented for selection | 948 | consult-widen-key | Widening key during completion | 949 | consult-yank-rotate | Rotate kill ring | 950 951 ** Fine-tuning of individual commands 952 :properties: 953 :alt_title: Fine-tuning 954 :description: Fine-grained configuration for special requirements 955 :end: 956 957 *NOTE:* Consult supports fine-grained customization of individual commands. This 958 configuration feature exists for experienced users with special requirements. 959 There is the [[https://github.com/minad/consult/wiki][Consult wiki]], where we collect further configuration examples. 960 961 Commands and buffer sources allow flexible, individual customization by using 962 the =consult-customize= macro. You can override any option passed to the internal 963 =consult--read= API. The [[https://github.com/minad/consult/wiki][Consult wiki]] already contains a numerous useful 964 configuration examples. Note that since =consult--read= is part of the internal 965 API, options could be removed, replaced or renamed in future versions of the 966 package. 967 968 Useful options are: 969 - =:prompt= set the prompt string 970 - =:preview-key= set the preview key, default is =consult-preview-key= 971 - =:initial= set the initial input 972 - =:default= set the default value 973 - =:history= set the history variable symbol 974 - =:add-history= add items to the future history, for example symbol at point 975 - =:sort= enable or disable sorting 976 - =:group= set to nil to disable candidate grouping and titles. 977 - =:inherit-input-method= set to non-nil to inherit the input method. 978 979 #+begin_src emacs-lisp 980 (consult-customize 981 ;; Disable preview for `consult-theme' completely. 982 consult-theme :preview-key nil 983 ;; Set preview for `consult-buffer' to key `M-.' 984 consult-buffer :preview-key "M-." 985 ;; For `consult-line' change the prompt and specify multiple preview 986 ;; keybindings. Note that you should bind <S-up> and <S-down> in the 987 ;; `minibuffer-local-completion-map' or `vertico-map' to the commands which 988 ;; select the previous or next candidate. 989 consult-line :prompt "Search: " 990 :preview-key '("S-<down>" "S-<up>")) 991 #+end_src 992 993 The configuration values are evaluated at runtime, just before the completion 994 session is started. Therefore you can use for example =thing-at-point= to adjust 995 the initial input or the future history. 996 997 #+begin_src emacs-lisp 998 (consult-customize 999 consult-line 1000 :add-history (seq-some #'thing-at-point '(region symbol))) 1001 1002 (defalias 'consult-line-thing-at-point 'consult-line) 1003 1004 (consult-customize 1005 consult-line-thing-at-point 1006 :initial (thing-at-point 'symbol)) 1007 #+end_src 1008 1009 Generally it is possible to modify commands for your individual needs by the 1010 following techniques: 1011 1012 1. Use =consult-customize= in order to change the command or source settings. 1013 2. Create your own wrapper function which passes modified arguments to the Consult functions. 1014 3. Create your own buffer [[#multiple-sources][multi sources]] for =consult-buffer=. 1015 4. Create advices to modify some internal behavior. 1016 5. Write or propose a patch. 1017 1018 * Recommended packages 1019 :properties: 1020 :description: Related packages recommended for installation 1021 :end: 1022 1023 I use and recommend this combination of packages: 1024 1025 - consult: This package 1026 - [[https://github.com/minad/vertico][vertico]]: Fast and minimal vertical completion system 1027 - [[https://github.com/minad/marginalia][marginalia]]: Annotations for the completion candidates 1028 - [[https://github.com/oantolin/embark][embark and embark-consult]]: Action commands, which can act on the completion candidates 1029 - [[https://github.com/oantolin/orderless][orderless]]: Completion style which offers flexible candidate filtering 1030 1031 There exist many other fine completion UIs beside Vertico, which are supported 1032 by Consult. Give them a try and find out which interaction model fits best for 1033 you. 1034 1035 - The builtin completion UI, which pops up the =*Completions*= buffer. 1036 - The builtin =icomplete-vertical-mode= in Emacs 28. 1037 - [[https://git.sr.ht/~protesilaos/mct][mct by Protesilaos Stavrou]]: Minibuffer and Completions in Tandem, which builds 1038 on the default completion UI (development currently [[https://protesilaos.com/codelog/2022-04-14-emacs-discontinue-mct/][discontinued]]). 1039 1040 Note that all packages are independent and can be exchanged with alternative 1041 components, since there exist no hard dependencies. Furthermore it is possible 1042 to get started with only default completion and Consult and add more components 1043 later to the mix. For example you can omit Marginalia if you don't need 1044 annotations. I highly recommend the Embark package, but in order to familiarize 1045 yourself with the other components, you can first start without it - or you could 1046 use with Embark right away and add the other components later on. 1047 1048 * Auxiliary packages 1049 :properties: 1050 :description: Integrations with the wider ecosystem 1051 :end: 1052 1053 You can integrate Consult with special programs or with other packages in the 1054 wider Emacs ecosystem. You may want to install some of theses packages depending 1055 on your preferences and requirements. 1056 1057 - [[https://github.com/yadex205/consult-ag][consult-ag]]: Support for the [[https://github.com/ggreer/the_silver_searcher][Silver Searcher]] in the style of =consult-grep=. 1058 - [[https://github.com/mohkale/consult-company][consult-company]]: Completion at point using the [[https://github.com/company-mode/company-mode][Company]] backends. 1059 - [[https://github.com/youngker/consult-codesearch.el][consult-codesearch]]: Integration with [[https://github.com/google/codesearch][Code Search]]. 1060 - [[https://github.com/karthink/consult-dir][consult-dir]]: Directory jumper using Consult multi sources. 1061 - [[https://codeberg.org/ravi/consult-dash][consult-dash]]: Consult interface to [[https://github.com/dash-docs-el/dash-docs][Dash documentation]] 1062 - [[https://github.com/mohkale/consult-eglot][consult-eglot]]: Integration with Eglot (LSP client). 1063 - [[https://github.com/minad/consult-flycheck][consult-flycheck]]: Additional Flycheck integration. 1064 - [[https://gitlab.com/OlMon/consult-flyspell][consult-flyspell]]: Additional Flyspell integration. 1065 - [[https://github.com/ghosty141/consult-git-log-grep][consult-git-log-grep]]: Consult interface to git log. 1066 - [[https://github.com/Nyoho/consult-hatena-bookmark][consult-hatena-bookmark]]: Access Hatena bookmarks. 1067 - [[https://github.com/rcj/consult-ls-git][consult-ls-git]]: List files from git via Consult. 1068 - [[https://github.com/gagbo/consult-lsp][consult-lsp]]: Integration with Lsp-mode (LSP client). 1069 - [[https://codeberg.org/jao/consult-notmuch][consult-notmuch]]: Access the [[https://notmuchmail.org/][Notmuch]] email system using Consult. 1070 - [[https://github.com/mclear-tools/consult-notes][consult-notes]]: Searching notes with Consult. 1071 - [[https://github.com/jgru/consult-org-roam][consult-org-roam]]: Integration with [[https://github.com/org-roam/org-roam][Org-roam]]. 1072 - [[https://github.com/Qkessler/consult-project-extra/][consult-project-extra]]: Additional project.el extras and buffer sources. 1073 - [[https://gitlab.com/OlMon/consult-projectile/][consult-projectile]]: Additional [[https://github.com/bbatsov/projectile][Projectile]] integration and buffer sources. 1074 - [[https://codeberg.org/jao/consult-recoll][consult-recoll]]: Access the [[https://www.lesbonscomptes.com/recoll/][Recoll]] desktop full-text search using Consult. 1075 - [[https://codeberg.org/jao/espotify][consult-spotify]]: Access the Spotify API and control your local music player. 1076 - [[https://github.com/mohkale/consult-yasnippet][consult-yasnippet]]: Integration with Yasnippet. 1077 - [[https://github.com/minad/affe][affe]]: Asynchronous Fuzzy Finder for Emacs based on Consult. 1078 1079 Not directly related to Consult, but maybe still of interest are the following 1080 packages. These packages should work well with Consult, follow a similar spirit or 1081 offer functionality based on ~completing-read~. 1082 1083 - [[https://github.com/minad/corfu][corfu]]: Completion systems for =completion-at-point= using small popups (Alternative to [[https://github.com/company-mode/company-mode][Company]]). 1084 - [[https://github.com/minad/cape][cape]]: Completion At Point Extensions, which can be used with =consult-completion-in-region= and [[https://github.com/minad/corfu][Corfu]]. 1085 - [[https://github.com/minad/bookmark-view][bookmark-view]]: Store window configuration as bookmarks, possible integration with =consult-buffer=. 1086 - [[https://github.com/bdarcus/citar][citar]]: Versatile package for citation insertion and bibliography management. 1087 - [[https://github.com/astoff/devdocs.el][devdocs]]: Emacs viewer for [[https://devdocs.io/][DevDocs]] with a convenient completion interface. 1088 - [[https://github.com/d12frosted/flyspell-correct][flyspell-correct]]: Apply spelling corrections by selecting via =completing-read=. 1089 - [[https://github.com/mhayashi1120/Emacs-wgrep][wgrep]]: Editing of grep buffers, use together with =consult-grep= via =embark-export=. 1090 - [[https://github.com/iyefrat/all-the-icons-completion][all-the-icons-completion]]: Icons for the completion UI. 1091 1092 * Bug reports 1093 :properties: 1094 :description: How to create reproducible bug reports 1095 :end: 1096 1097 If you find a bug or suspect that there is a problem with Consult, please carry 1098 out the following steps: 1099 1100 1. *Search through the issue tracker* if your issue has been reported before (and 1101 has been resolved eventually) in the meantime. 1102 2. *Remove all packages involved in the suspected bug from your installation.* 1103 3. *Reinstall the newest version of all relevant packages*. Updating alone is not 1104 sufficient, since package.el is known to cause miscompilation. The list of 1105 packages includes Consult, Compat, Vertico or other completion UIs, 1106 Marginalia, Embark and Orderless. 1107 4. Either use the default completion UI or ensure that exactly one of 1108 =vertico-mode=, =mct-mode=, or =icomplete-mode= is enabled. The unsupported modes 1109 =selectrum-mode=, =ivy-mode=, =helm-mode=, =ido-mode= and =ido-ubiquitous-mode= must be 1110 disabled. 1111 5. Ensure that the =completion-styles= variable is properly configured. Try to set 1112 =completion-styles= to a list including =substring= or =orderless=. 1113 6. Try to reproduce the issue by starting a bare bone Emacs instance with =emacs -Q= 1114 on the command line. Execute the following minimal code snippets in the 1115 scratch buffer. This way we can exclude side effects due to configuration 1116 settings. If other packages are relevant to reproduce the issue, include them 1117 in the minimal configuration snippet. 1118 1119 Minimal setup with Vertico for =emacs -Q=: 1120 #+begin_src emacs-lisp 1121 (package-initialize) 1122 (require 'consult) 1123 (require 'vertico) 1124 (vertico-mode) 1125 (setq completion-styles '(substring basic)) 1126 #+end_src 1127 1128 Minimal setup with the default completion system for =emacs -Q=: 1129 #+begin_src emacs-lisp 1130 (package-initialize) 1131 (require 'consult) 1132 (setq completion-styles '(substring basic)) 1133 #+end_src 1134 1135 Please provide the necessary important information with your bug report: 1136 1137 - The minimal configuration snippet used to reproduce the issue. 1138 - Your completion UI (Default completion, Vertico, Mct or Icomplete). 1139 - A stack trace in case the bug triggers an exception. 1140 - Your Emacs version, since bugs may be fixed or introduced in newer versions. 1141 - Your operating system, since Emacs behavior varies between Linux, Mac and 1142 Windows. 1143 - The package manager, e.g., straight.el or package.el, used to install 1144 the Emacs packages, in order to exclude update issues. Did you install 1145 Consult as part of the Doom or Spacemacs Emacs distributions? 1146 - Do you use Evil or other packages which apply deep changes? 1147 Consult does not provide Evil integration out of the box, but there is some 1148 support in [[https://github.com/emacs-evil/evil-collection][evil-collection]]. 1149 1150 When evaluating Consult-related code snippets you should enable [[https://www.gnu.org/software/emacs/manual/html_node/elisp/Lexical-Binding.html][lexical binding]]. 1151 Consult often relies on lambdas and lexical closures. 1152 1153 * Contributions 1154 :properties: 1155 :description: Feature requests and pull requests 1156 :end: 1157 1158 Consult is a community effort, please participate in the discussions. 1159 Contributions are welcome, but you may want to discuss potential contributions 1160 first. Since this package is part of [[https://elpa.gnu.org/packages/consult.html][GNU ELPA]] contributions require a copyright 1161 assignment to the FSF. 1162 1163 If you have a proposal, take a look at the [[https://github.com/consult/issues][Consult issue tracker]] and the [[https://github.com/minad/consult/issues/6][Consult 1164 wishlist]]. There have been many prior feature discussions. Please search through 1165 the issue tracker, maybe your issue or feature request has already been 1166 discussed. You can contribute to the [[https://github.com/minad/consult/wiki][Consult wiki]], in case you want to share 1167 small configuration or command snippets. 1168 1169 * Acknowledgments 1170 :properties: 1171 :description: Contributors and Sources of Inspiration 1172 :end: 1173 1174 This package took inspiration from [[https://github.com/abo-abo/swiper#counsel][Counsel]] by Oleh Krehel. Some of the Consult 1175 commands originated in the Counsel package or the wiki of the Selectrum package. 1176 This package exists only thanks to the help of these great contributors and 1177 thanks to the feedback of many users. Thank you! 1178 1179 Code contributions: 1180 - [[https://github.com/oantolin/][Omar Antolín Camarena]] 1181 - [[https://github.com/s-kostyaev/][Sergey Kostyaev]] 1182 - [[https://github.com/okamsn/][Earl Hyatt]] 1183 - [[https://github.com/clemera/][Clemens Radermacher]] 1184 - [[https://github.com/tomfitzhenry/][Tom Fitzhenry]] 1185 - [[https://github.com/jakanakaevangeli][jakanakaevangeli]] 1186 - [[https://hg.serna.eu][Iñigo Serna]] 1187 - [[https://github.com/aspiers/][Adam Spiers]] 1188 - [[https://github.com/omar-polo][Omar Polo]] 1189 - [[https://github.com/astoff][Augusto Stoffel]] 1190 - [[https://github.com/noctuid][Fox Kiester]] 1191 - [[https://github.com/tecosaur][Tecosaur]] 1192 - [[https://github.com/mohamed-abdelnour][Mohamed Abdelnour]] 1193 - [[https://github.com/thisirs][Sylvain Rousseau]] 1194 - [[https://github.com/jdtsmith][J.D. Smith]] 1195 - [[https://github.com/mohkale][Mohsin Kaleem]] 1196 - [[https://github.com/jyp][Jean-Philippe Bernardy]] 1197 - [[https://github.com/aagon][Aymeric Agon-Rambosson]] 1198 - [[https://github.com/geolessel][Geoffrey Lessel]] 1199 - [[https://github.com/piotrkwiecinski][Piotr Kwiecinski]] 1200 - [[https://github.com/rswgnu][Robert Weiner]] 1201 1202 Advice and useful discussions: 1203 - [[https://github.com/clemera/][Clemens Radermacher]] 1204 - [[https://github.com/oantolin/][Omar Antolín Camarena]] 1205 - [[https://protesilaos.com][Protesilaos Stavrou]] 1206 - [[https://github.com/purcell/][Steve Purcell]] 1207 - [[https://github.com/alphapapa/][Adam Porter]] 1208 - [[https://github.com/manuel-uberti/][Manuel Uberti]] 1209 - [[https://github.com/tomfitzhenry/][Tom Fitzhenry]] 1210 - [[https://github.com/hmelman/][Howard Melman]] 1211 - [[https://github.com/monnier/][Stefan Monnier]] 1212 - [[https://github.com/dgutov/][Dmitry Gutov]] 1213 - [[https://github.com/iyefrat][Itai Y. Efrat]] 1214 - [[https://github.com/bdarcus][Bruce d'Arcus]] 1215 - [[https://github.com/jdtsmith][J.D. Smith]] 1216 - [[https://github.com/Qkessler][Enrique Kessler Martínez]] 1217 - [[https://github.com/raxod502][Radon Rosborough]] 1218 1219 Authors of supplementary =consult-*= packages: 1220 1221 - [[https://codeberg.org/jao/][Jose A Ortega Ruiz]] ([[https://codeberg.org/jao/consult-notmuch][consult-notmuch]], [[https://codeberg.org/jao/consult-recoll][consult-recoll]], [[https://codeberg.org/jao/espotify][consult-spotify]]) 1222 - [[https://github.com/gagbo/][Gerry Agbobada]] ([[https://github.com/gagbo/consult-lsp][consult-lsp]]) 1223 - [[https://github.com/karthink][Karthik Chikmagalur]] ([[https://github.com/karthink/consult-dir][consult-dir]]) 1224 - [[https://github.com/mohkale][Mohsin Kaleem]] ([[https://github.com/mohkale/consult-company][consult-company]], [[https://github.com/mohkale/consult-eglot][consult-eglot]], [[https://github.com/mohkale/consult-yasnippet][consult-yasnippet]]) 1225 - [[https://gitlab.com/OlMon][Marco Pawłowski]] ([[https://gitlab.com/OlMon/consult-flyspell][consult-flyspell]], [[https://gitlab.com/OlMon/consult-projectile][consult-projectile]]) 1226 - [[https://github.com/Qkessler][Enrique Kessler Martínez]] ([[https://github.com/Qkessler/consult-project-extra][consult-project-extra]]) 1227 - [[https://github.com/jgru][Jan Gru]] ([[https://github.com/jgru/consult-org-roam][consult-org-roam]]) 1228 - [[https://github.com/yadex205][Kanon Kakuno]] ([[https://github.com/yadex205/consult-ag][consult-ag]]) 1229 - [[https://github.com/rcj][Robin Joy]] ([[https://github.com/rcj/consult-ls-git][consult-ls-git]]) 1230 - [[https://codeberg.org/ravi][Ravi R Kiran]] [[https://codeberg.org/ravi/consult-dash][(consult-dash]]) 1231 - [[https://github.com/mclearc][Colin McLear]] ([[https://github.com/mclear-tools/consult-notes][consult-notes]]) 1232 - [[https://github.com/Nyoho][Yukinori Kitadai]] ([[https://github.com/Nyoho/consult-hatena-bookmark][consult-hatena-bookmark]]) 1233 - [[https://github.com/ghosty141][ghosty141]] ([[https://github.com/ghosty141/consult-git-log-grep][consult-git-log-grep]]) 1234 - [[https://github.com/youngker][YoungJoo Lee]] ([[https://github.com/youngker/consult-codesearch.el][consult-codesearch]]) 1235 1236 #+html: <!-- 1237 1238 * Indices 1239 :properties: 1240 :description: Indices of concepts and functions 1241 :end: 1242 1243 ** Function index 1244 :properties: 1245 :description: List of all Consult commands 1246 :index: fn 1247 :end: 1248 1249 ** Concept index 1250 :properties: 1251 :description: List of all Consult-specific concepts 1252 :index: cp 1253 :end: 1254 1255 #+html: -->