Releases: radian-software/selectrum
Selectrum 3.1
Deprecated
- The
selectrum-readAPI has been deprecated and made private. The intention of this change is to encourage users instead to rely on the plaincompleting-readfunction, which is completion system agnostic ([#446]). - The user option
selectrum-fix-minibuffer-heighthas been deprecated. The new variableselectrum-fix-vertical-window-heighttakes its place ([#305]). - The special text property
selectrum-candidate-fullto change the canonical representation of a candidate has been deprecated ([#403]). - The hooks
selectrum-candidate-inserted-hookandselectrum-candidate-selected-hookoriginally also received the arguments passed toselectrum-readwhich has been deprecated. These hooks are expected to be updated to only receive a single argument now, the inserted/selected candidate ([#446]). selectrum-default-candidate-refine-functionandselectrum-default-candidate-highlight-functionhave been deprecated, see the new default values forselectrum-refine-candidates-functionandselectrum-highlight-candidates-functionwhich should be used instead ([#330]).
Changed defaults
- The default value of
selectrum-num-candidates-displayedhas changed toauto. If you have customizedselectrum-num-candidates-displayedyou should remove that from your configuration or also adjust it toauto. For configuring the window height you should use the newselectrum-max-window-heightoption now ([#305]). - The new default functions used for
selectrum-refine-candidates-functionandselectrum-highlight-candidates-functionhave been updated to filter and highlight candidates according tocompletion-stylesnow ([#330]).
Features
- Line spacing is taken into account when using a fixed window height ([#424], [#432]).
- The new option
selectrum-max-window-heightcan now be used to configure the maximal display window height analogue to the built-inmax-mini-window-height. The new option replaces the usage of the formerly usedselectrum-num-candidates-displayedsetting which is now set toautoby default. By usingautothe number of candidates is automatically determined using the available space and current display settings. When setting the value to a number this will determine the actual amount of displayed candidates without having an effect on the window height ([#305]). - The option
selectrum-display-stylecan be used to configure the display style for candidates. Vertical and horizontal display styles are included and you can cycle through styles using the newselectrum-cycle-display-stylecommand which uses theselectrum-display-style-cycle-listoption for cycling ([#305]). selectrum-exhibitgot an optional argument which allows to keep the current candidate selected after the update which is helpful for async completions ([#306], [#307], [#349]).- The user option
selectrum-display-actioncan be used to show candidates in another window or frame ([#230], [#309]). - The user option
selectrum-show-indicescan now be a function that can be used to control the display of the a candidate's index ([#200]). - The user option
selectrum-extend-current-candidate-highlightdetermines whether to extend the highlighting of the current candidate until the margin (the default is nil). See [#208]. - The user option
selectrum-complete-in-buffercan be used to control whether Selectrum should handle in buffer completion (the default is t) ([#261]). - The user option
selectrum-default-value-formatcan be used to specify the formatting of the default value indicator ([#445]).
Enhancements
- When hovering over candidates with the mouse there are no messages shown anymore which avoids interference with candidates display ([#452]).
- The variable
selectrum-should-sort-pandselectrum-active-phave been marked deprecated. You should use the newselectrum-should-sortandselectrum-is-active.selectrum-should-sortis also exposed as a user option now ([#441]). - The variable
selectrum-move-default-candidatecan be used to configure how the UI handles the default value ([#441]). - The command
selectrum-repeatcan also repeat the last recursive session now ([#322], [#440]). - The default value of
selectrum-extend-current-candidate-highlighthas been changed toautowhich will automatically extend the highlighting if the session uses annotations ([#427], [#430]). - The accessibility of the default value in file completions has been improved. When the default exists in the prompting directory it gets sorted first otherwise the default is included as a virtual candidate ([#400], [#420], [#421]).
- Depending on the used font and display settings like
line-spacingthe minibuffer height could be slightly off so that the displayed candidates wouldn't be completely visible, which has been fixed ([#303], [#414]). - The sorting of passed defaults for file completions has been improved such that paths like "/home/user/default", "~/default" or a relative passed default get sorted first when they exist within the prompting directory ([#402], [#404]).
- Tramp completions have been improved. You now get completion for tramp methods and hosts. If a connection hasn't been established yet and you are manually typing the path, a message is shown that you can refresh using
selectrum-insert-current-candidatewhich helps correcting typos before trying to establish a new connection. Lastly if tramp would error or you would quit from a password prompt Selectrum stopped working until you restarted the session, which has been fixed ([#392], [#394], [#405], [#408]). - Selectrum will allow recursive sessions for
selectrum-completion-in-regionandselectrum-select-from-historyso these commands work even ifenable-recursive-minibuffersis not set by the user ([#100], [#397]). - In file completions where the directory path of the input does not exist, the candidates are automatically gathered by interpreting the input as an partial-completion style input pattern (see
completion-styles-alist). For example the input "/us/l/bi/" would give results for "/usr/local/bin/". With tramp paths this has to be triggered manually usingselectrum-insert-current-candidateto avoid possible speed problems ([#390], [#393]). - You can now complete environment variables in file completions by typing a "$" after a "/" ([#386], [#389]).
- The
selectrum-select-from-historycommand has been improved. You can now insert a history item into the previous session using your default binding forselectrum-insert-current-candidate. To submit the history item and exit useselectrum-select-current-candidate([#362]). - When using commands where the prompt would exceed the window width the horizontal scroll wouldn't reset afterwards when a smaller element was pulled into the prompt under certain conditions (for example when using history commands), which has been fixed ([#360]).
- When the prompt is empty and the default value is shown you can now insert it using
selectrum-insert-current-candidate. Alsoselectrum-insert-current-candidatenow moves point to end of the prompt even when there were no candidate insertion to have consistent UI behaviour ([#359], [#369]). selectrum-insert-current-candidatewill resetminibuffer-history-position, so that after "choosing" an item and using other history commands in succession the history will start from the beginning ([#361], [#368]).- History commands don't automatically trigger a refresh for tramp paths. This is useful to prevent unintended opening of tramp connections. To trigger a refresh for the selected tramp path you can use
selectrum-insert-current-candidate([#358], [#361], [#365], [#367], [#368], [#372]). - In file completions the prompt will also be selected when a match is required and the path exists ([#357]).
- Improved selection behaviour for history commands. When using
next-history-element,previous-history-elementor isearch for history browsing the inserted history element will get selected when a match isn't required ([#323], [#324], [#341], [#346], [#380]). - Improved exit behaviour of
selectrum-select-current-candidate. The commands gives feedback now when match is required and submission not possible. Also it allows submission of the prompt when a match is required and the prompt is a member of candidates ([#338]). - You can now configure the initial filtering for candidates in
selectrum-completion-in-regionusingselectrum-completion-in-region-styles([#331], [#356]). - Computation of candidates is faster for
describe-variable([#312], [#316], [#320], [#321], [#343]). - Candidates of
completing-read-multiplewhich are submitted byselectrum-select-current-candidateare now passed toselectrum-candidate-selected-hookone by one in the order they were added. Before the hook would not run for the multi candidates case ([#296]). - File completions are faster because the internal handling was updated ([#334], [#335], [#339]). Most notably recomputation only happens on directory change now. Before, the candidates where recomputed on each input change which could slow down file completions significantly for cases where
read-file-name-internalwould be slow already ([#210], [#276], [#277]). - You can now give a prefix argument to selection moving commands ([#275]).
- If completion table metadata or
completion-extra-propertiesdefine anaffixation-function(introduced in Emacs 28) Selectrum will use this information to annotate the candidates accordingly ([#240], [#271], [#286], [#288], [#289]). - The argument passed to
selectrum-select-current-candidateandselectrum-insert-current-candidateis now used to choose the nth displayed candidate instead of calculating an index based on the currently selected candidate ([#194], [#215]). selectrum-insert-current-candidateno longer adds inserted candidates to the history ([#212], [#213]).
...
Selectrum 3.0
Breaking changes
- The function
selectrum-read-directory-nameis no longer available. - When reading directories and the default is already in the prompt, it gets selected so you can immediately submit it (#126, #127). In correspondence with this change, the initial working directory for
read-directory-nameis now unchanged from the Emacs default, rather than being the parent directory. - Selectrum now uses a keymap (
selectrum-minibuffer-map) instead of an alist (selectrum-minibuffer-bindings, now removed) for configuring bindings (#186). This better meets users' expectations, and allows other packages (e.g., General) to better work with Selectrum's keybindings (#71).
Features
- The user option
selectrum-completing-read-multiple-show-helpcan be used to control display of additional usage information in the prompt in acompleting-read-multiplesession (#130, #132). selectrum-readaccepts two additional keyword argumentsminibuffer-completion-tableandminibuffer-completion-predicate. These can be used to pass thecompleting-readcollection and predicate so they are available for internal handling of completion API features and for other external commands or packages which make use of them (#94, #95).- If the completion table passed to
completing-readprovidesannotation-functionordisplay-sort-functionin its metadata, Selectrum will use this information to annotate or sort the candidates accordingly. Annotations defined bycompletion-extra-propertiesare handled, too (#82, #95). - One can trigger an update of Selectrum's completions UI manually by calling
selectrum-exhibit(#95). - You can now interact with candidates via the mouse. Left click (
mouse-1) selects the candidate, and right click (mouse-3) inserts the candidate, just likeRETandTAB, respectively. See #113 and #118.
Enhancements
- If
selectrum-candidate-display-right-marginis used the margin is included in the highlighting of the selected candidate so it's easier to see to which candidate the margin belongs to (#166). - If the
default-filenamepassed toselectrum-read-file-nameis an absolute path it will still be sorted to the top when it is contained in the prompting directory (#160). icomplete-modeis now automatically disabled when entering Selectrum, to avoid conflicts (#99).- Working with the default candidate has been improved in cases where it is not in the candidate list. Such candidates are currently shown in the prompt message. For example, the command
lgrepmight suggest searching through files matching*.elinstead of just a specific file. See #120, #122.- While there is no user input, the default candidate remains visible in the prompt message. Previously, it would be hidden when the prompt line was not selected. Unchanged is the behavior is to hide the default candidate when text is typed, so that it is only visible when it can be submitted (similar to the effect of
minibuffer-electric-default-mode). - The default candidate shown in the prompt message is now displayed with the face
selectrum-current-candidatewhen it is selected. - Now that Selectrum always shows the default candidate when it can be submitted, it now attempts to remove the default candidate from prompt messages that already contain it. This decreases redundancy.
- While there is no user input, the default candidate remains visible in the prompt message. Previously, it would be hidden when the prompt line was not selected. Unchanged is the behavior is to hide the default candidate when text is typed, so that it is only visible when it can be submitted (similar to the effect of
- When there is no default value the prompt shows
[default-value : ""]to indicate that you would submit the empty string. Previously it showed[default-value: none](#133). - When reading file names spaces are now considered symbol constituents which means you can use s-expression commands to navigate and edit the input more efficently. A binding for
backward-kill-sexpwas added to go up a directory withC-M-DEL(#138). - Compliance to default minibuffer API has been further improved by using an overlay for candidates display. Previously code which assumed that the minibuffer only contains user input would be likely to fail (#124). This also means inside the minibuffer
minibuffer-contentsnow returns only the current input as expected (#116, #133). - Multiline candidates are now merged into a single truncated line so there is no gradual scrolling effect anymore when going through the candidate list. The first matched line is shown in front of the merged lines (#133). This formatting is customizable via
selectrum-multiline-display-settings(#147). selectrum-insert-current-candidatenow automatically inserts the separator for common values ofcrm-separatorwhen usingcompleting-read-multiple(#197).
Bugs fixed
- The minibuffer height is now determined by the actual height of displayed candidates. Previously the height could be off for candidates containing unicode characters or other means which changed the display height such as
line-spacing(#146, #151, #154). - When passing a named function or compiled lambda as CANDIDATES argument to
selectrum-readan error would be thrown, which has been fixed (#163). - When selecting file name prompts and submitting them the result will be the selected prompt. Previously it could be the default file name passed to
selectrum-read-file-namewhich is the behavior of default completion where there is no concept of an active selection (#157, #160). - When there are no candidates and a match isn't required the prompt will now be shown as selected to indicate one can submit the input (#160).
- If the MUSTMATCH argument to
read-directory-namewas non-nil the selection of the prompt wasn't visible which has been fixed (#157, #160). - If a predicate was passed to
read-bufferan error would be thrown which has been fixed (#159, #161). - Dynamic collection functions can now reuse their returned candidates. Previously Selectrum could modify them even when the
:may-modify-candidatesargument wasn't passed toselectrum-read. - Incremental history search via
isearchwasn't working which has been fixed (#124, #133). - Empty string completion candidates are now ignored like in the default completion UI (#101).
- Text properties are now stripped for standard completion functions (#107, #108).
- You can now select and submit empty input and for file prompts existing paths when require-match is non-nil (#67, #125).
- The default candidate is now first selected, even when it is not in the candidate list, conforming with expectations. Previously, the first candidate in the list was selected instead. See #120.
selectrum-insert-current-candidatenow works correctly forcompleting-read-multiplewhencrm-separatorhas a non default value. Previously it would replace the separator with commas when adding new candidates (#140).selectrum-insert-current-candidatenow works fromselectrum-select-from-historyand other commands which ignore history by settingminibuffer-history-variabletot. Previously an error would be thrown (#152).- When completing filenames and a match is required, non-normalized paths (e.g.,
~/Documents//etc/hosts) are accepted (#190). - Pressing TAB when nothing matches shows a “No match” message in the minibuffer instead of signaling an error and erasing the minibuffer contents (#193). If
completion-fail-discreetlyis non-nil, nothing is done. - Fix type mismatch when configuring
selectrum-count-stylein customizations. - Submitting the default value with the empty prompt does no longer strip the text properties of the default candidate (#180, #198).
Selectrum 2.0
Breaking changes
-
The way to dynamically generate the candidate list has changed.
Instead of rebinding
selectrum-preprocess-candidates-functionandselectrum-refine-candidates-function, you simply pass a function as the COLLECTION argument toselectrum-read. This function takes one argument, the current user input, and returns the list of candidates as strings. Alternatively, it can return an alist whosecandidateskey is the candidate list and whoseinputkey is a transformed user input to use for highlighting.As part of this change,
selectrum-refine-candidates-functionno longer can return an alist; that functionality should instead be moved to the CANDIDATES function. (This feature was never properly supported in the first place if you tried to use it in a way that can't be done equivalently in the CANDIDATES function.)See #27.
Features
- You can now give a prefix argument to
selectrum-insert-current-candidateto insert the candidate at a given index directly (#96). - Candidates inserted by
selectrum-insert-current-candidateare now added to history (#54). - You can resume the last completion session using the
selectrum-repeatcommand. (Note that you must bind this command to a key sequence in order to use it.) This command implements similar functionality toivy-resume. See #39. - Experimental support for using Selectrum as a backend for Helm commands. Use it by enabling
selectrum-helm-modefrom theselectrum-helmlibrary. See #18. - You can now give a prefix argument to
selectrum-select-current-candidateto select the candidate at a given index directly. New user optionselectrum-show-indicesto display these indices for your convenience. This feature implements similar functionality toivy-avy. See #16. - Recursive minibuffers are now supported.
- In the standard
completing-readinterface, you can useprevious-matching-history-elementto retrieve history elements. The binding now works properly in Selectrum too, except that you can use Selectrum to select a history element. See #49, #77. If you prefer to use the original interface you can useselectrum-previous-history-elementwhich is just not bound by default #57. - You can now cause the minibuffer to always have the same height, even if there are fewer candidates, by enabling
selectrum-fix-minibuffer-height(#35). - Multiple candidate selection is now supported, and we provide a
selectrum-completing-read-multiplefunction which is installed automatically byselectrum-mode. This means that commands likedescribe-face(which delegate tocompleting-read-multipleinternally) now use Selectrum by default. To select additional candidates within a supported command, useTABand inputcrm-separator(,by default). See #53, #80, #74. - We provide a
selectrum-completion-in-regionfunction now and install it oncompletion-in-region-functioninselectrum-mode, socompletion-at-pointwill use Selectrum when there is more than one completion (#42). This function can display annotation informations if thecompletion-at-point-functionbackend offers them (#62), and will respect completion boundaries (#89). Appearance can be configured using the facesselectrum-completion-annotation,selectrum-completion-docsig, andcompletions-common-part(#86).
Enhancements
selectrum-read-file-namewhich is used asread-file-name-functionnow usesread-file-name-defaultinternally. This means all default features of file completion should be available now. Most notably you can now useM-nto insert file names into the minibuffer (usingfile-name-at-point-functions) and you are able to use shortcuts like//or~/(#50, #52).- In
read-file-name, when a default is provided (for example in thedired-do-renamecommand), we actually use it as the initial contents of the minibuffer, which allows you to have convenient access to the default filename when that default file does not exist (#25). - We now bind
minibuffer-completing-file-nameduringread-file-name, in conformance with the standard Emacs interface (#30). - A new text property
selectrum-candidate-display-right-marginis added, to display a string at the right margin after a candidate (#44). - You can now access standard minibuffer history using
M-pandM-n(#4, #38). - Previously, setting
resize-mini-windowsto nil would cause Selectrum to be unable to display any candidates. This has been fixed by having Selectrum bind the variable togrow-onlywhen entering the minibuffer (#35). - Previously, a large value of
selectrum-num-candidates-displayedwould produce a confusing result becausemax-mini-window-heightimposed a lower limit on the height of the minibuffer. Now that variable is bound automatically by Selectrum based on the value ofselectrum-num-candidates-displayed(#22). - Multiline candidates are now displayed properly and do not mess up scrolling in the candidate list (#12).
- When you select the user input area and it doesn't have anything typed, we now show an overlay indicating that you are in this state, so it is less confusing. The overlay shows what default value will be submitted if you press return. See #55.
- Switching buffers is now less confusing, because we don't modify the order of the buffer list at all. Previously the default buffer to switch to was moved to the top of the list. Now we leave it where it is, and just select it initially.
selectrum-readgrows a new argument:no-move-default-candidateto support this improvement. - Previously,
selectrum-readsometimes modified the list of candidates it was given. This has been fixed, and there is a new keyword argument:may-modify-candidatesto re-enable the old behavior for cases where it is safe and the performance gains are useful. See #74.
Bugs fixed
- You can now use the undo system in the minibuffer. Previously, trying to do so would break Selectrum (#31).
- Passing a list of symbols to
selectrum-completing-readworks now. - Previously,
selectrum-read-bufferignored its PREDICATE argument. This has now been fixed (#32, #33). - Previously,
selectrum-readwould return nil whenselectrum-submit-exact-inputwas used on an empty input and no:default-candidatewas provided. Now the empty string is returned, in accordance with thecompleting-readAPI (#34). - The keymap used in the minibuffer now inherits from
minibuffer-local-map, so standard minibuffer bindings should still work (raxod502/ctrlf#41). - The application of face
selectrum-current-candidatedoes not trample on the results ofselectrum-highlight-candidates-function. In other words, the matched part of the current candidate is now highlighted just like the matched part of the other candidates. See (#21, #76). - Previously, an error was thrown if you used certain non-Selectrum minibuffer commands before loading Selectrum. This has been fixed (#28).
- If
selectrum-num-candidates-displayedis set to one, the highlighting now works correctly. Before, the prompt would get highlighted instead of the current candidate. See #85. selectrum-read-library-namepreviously, in certain versions of Emacs, showed some entries with.elappended. This has now been fixed. Also,TABnow inserts the current candidate and not the whole path to the library, so that the result can be submitted directly (#73).
Selectrum 1.0
Added
- Package
selectrum - Minor mode
selectrum-mode - Faces:
selectrum-current-candidateselectrum-primary-highlightselectrum-secondary-highlight
- Interface user options:
selectrum-num-candidates-displayedselectrum-minibuffer-bindingsselectrum-count-style
- Commands bound in minibuffer:
selectrum-previous-candidateselectrum-next-candidateselectrum-previous-pageselectrum-next-pageselectrum-goto-beginningselectrum-goto-endselectrum-kill-ring-saveselectrum-select-current-candidateselectrum-submit-exact-inputselectrum-insert-current-candidate
- Entry points:
selectrum-readselectrum-completing-readselectrum-read-bufferselectrum-read-file-nameselectrum-read-directory-nameselectrum-read-library-name
- Hooks:
selectrum-candidate-selected-hookselectrum-candidate-inserted-hook
- API user options, variables, and functions:
selectrum-refine-candidates-functionselectrum-default-candidate-refine-functionselectrum-preprocess-candidates-functionselectrum-default-candidate-preprocess-functionselectrum-highlight-candidates-functionselectrum-default-candidate-highlight-functionselectrum-should-sort-p