summaryrefslogtreecommitdiff
path: root/lisp/minibuffer.el
Commit message (Collapse)AuthorAgeFilesLines
...
* Further tweak minibuffer-inactive-mode doc stringLars Ingebrigtsen2021-08-121-1/+2
| | | | | * lisp/minibuffer.el (minibuffer-inactive-mode): Mention `minibuffer-exit-hook' (bug#13641).
* Improve minibuffer-inactive-mode documentationLars Ingebrigtsen2021-08-121-1/+8
| | | | | * lisp/minibuffer.el (minibuffer-inactive-mode): Clarify when it's used (bug#13641).
* Use string-search instead of string-match[-p]Mattias Engdegård2021-08-091-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `string-search` is easier to understand, less error-prone, much faster, does not pollute the regexp cache, and does not mutate global state. Use it where applicable and obviously safe (erring on the conservative side). * admin/authors.el (authors-canonical-file-name) (authors-scan-change-log): * lisp/apropos.el (apropos-command) (apropos-documentation-property, apropos-symbols-internal): * lisp/arc-mode.el (archive-arc-summarize) (archive-zoo-summarize): * lisp/calc/calc-aent.el (math-read-factor): * lisp/calc/calc-ext.el (math-read-big-expr) (math-format-nice-expr, math-format-number-fancy): * lisp/calc/calc-forms.el (math-read-angle-brackets): * lisp/calc/calc-graph.el (calc-graph-set-range): * lisp/calc/calc-keypd.el (calc-keypad-press): * lisp/calc/calc-lang.el (tex, latex, math-read-big-rec): * lisp/calc/calc-prog.el (calc-fix-token-name) (calc-user-define-permanent, math-define-exp): * lisp/calc/calc.el (calc-record, calcDigit-key) (calc-count-lines): * lisp/calc/calcalg2.el (calc-solve-for, calc-poly-roots) (math-do-integral): * lisp/calc/calcalg3.el (calc-find-root, calc-find-minimum) (calc-get-fit-variables): * lisp/cedet/ede/speedbar.el (ede-tag-expand): * lisp/cedet/semantic/java.el (semantic-java-expand-tag): * lisp/cedet/semantic/sb.el (semantic-sb-show-extra) (semantic-sb-expand-group): * lisp/cedet/semantic/wisent/python.el (semantic-python-instance-variable-p): * lisp/cus-edit.el (get): * lisp/descr-text.el (describe-text-sexp): * lisp/dired-aux.el (dired-compress-file): * lisp/dired-x.el (dired-make-relative-symlink): * lisp/dired.el (dired-glob-regexp): * lisp/dos-fns.el (dos-convert-standard-filename, dos-8+3-filename): * lisp/edmacro.el (edmacro-format-keys): * lisp/emacs-lisp/eieio-opt.el (eieio-sb-expand): * lisp/emacs-lisp/eieio-speedbar.el (eieio-speedbar-object-expand): * lisp/emacs-lisp/lisp-mnt.el (lm-keywords-list): * lisp/emacs-lisp/warnings.el (display-warning): * lisp/emulation/viper-ex.el (viper-ex-read-file-name) (ex-print-display-lines): * lisp/env.el (read-envvar-name, setenv): * lisp/epa-mail.el (epa-mail-encrypt): * lisp/epg.el (epg--start): * lisp/erc/erc-backend.el (erc-parse-server-response): * lisp/erc/erc-dcc.el (erc-dcc-member): * lisp/erc/erc-speedbar.el (erc-speedbar-expand-server) (erc-speedbar-expand-channel, erc-speedbar-expand-user): * lisp/erc/erc.el (erc-send-input): * lisp/eshell/em-glob.el (eshell-glob-entries): * lisp/eshell/esh-proc.el (eshell-needs-pipe-p): * lisp/eshell/esh-util.el (eshell-convert): * lisp/eshell/esh-var.el (eshell-envvar-names): * lisp/faces.el (x-resolve-font-name): * lisp/ffap.el (ffap-file-at-point): * lisp/files.el (wildcard-to-regexp, shell-quote-wildcard-pattern): * lisp/forms.el (forms--update): * lisp/frameset.el (frameset-filter-unshelve-param): * lisp/gnus/gnus-art.el (article-decode-charset): * lisp/gnus/gnus-kill.el (gnus-kill-parse-rn-kill-file): * lisp/gnus/gnus-mlspl.el (gnus-group-split-fancy): * lisp/gnus/gnus-msg.el (gnus-summary-resend-message-insert-gcc) (gnus-inews-insert-gcc): * lisp/gnus/gnus-rfc1843.el (rfc1843-decode-article-body): * lisp/gnus/gnus-search.el (gnus-search-indexed-parse-output) (gnus-search--complete-key-data): * lisp/gnus/gnus-spec.el (gnus-parse-simple-format): * lisp/gnus/gnus-sum.el (gnus-summary-refer-article): * lisp/gnus/gnus-util.el (gnus-extract-address-components) (gnus-newsgroup-directory-form): * lisp/gnus/gnus-uu.el (gnus-uu-grab-view): * lisp/gnus/gnus.el (gnus-group-native-p, gnus-short-group-name): * lisp/gnus/message.el (message-check-news-header-syntax) (message-make-message-id, message-user-mail-address) (message-make-fqdn, message-get-reply-headers, message-followup): * lisp/gnus/mm-decode.el (mm-dissect-buffer): * lisp/gnus/nnheader.el (nnheader-insert): * lisp/gnus/nnimap.el (nnimap-process-quirk) (nnimap-imap-ranges-to-gnus-ranges): * lisp/gnus/nnmaildir.el (nnmaildir--ensure-suffix): * lisp/gnus/nnmairix.el (nnmairix-determine-original-group-from-path): * lisp/gnus/nnrss.el (nnrss-match-macro): * lisp/gnus/nntp.el (nntp-find-group-and-number): * lisp/help-fns.el (help--symbol-completion-table-affixation): * lisp/help.el (help-function-arglist): * lisp/hippie-exp.el (he-concat-directory-file-name): * lisp/htmlfontify.el (hfy-relstub): * lisp/ido.el (ido-make-prompt, ido-complete, ido-copy-current-word) (ido-exhibit): * lisp/image/image-converter.el (image-convert-p): * lisp/info-xref.el (info-xref-docstrings): * lisp/info.el (Info-toc-build, Info-follow-reference) (Info-backward-node, Info-finder-find-node) (Info-speedbar-expand-node): * lisp/international/mule-diag.el (print-fontset-element): * lisp/language/korea-util.el (default-korean-keyboard): * lisp/linum.el (linum-after-change): * lisp/mail/ietf-drums.el (ietf-drums-parse-address): * lisp/mail/mail-utils.el (mail-dont-reply-to): * lisp/mail/rfc2047.el (rfc2047-encode-1, rfc2047-decode-string): * lisp/mail/rfc2231.el (rfc2231-parse-string): * lisp/mail/rmailkwd.el (rmail-set-label): * lisp/mail/rmailsum.el (rmail-header-summary): * lisp/mail/smtpmail.el (smtpmail-maybe-append-domain) (smtpmail-user-mail-address): * lisp/mail/uce.el (uce-reply-to-uce): * lisp/man.el (Man-default-man-entry): * lisp/mh-e/mh-alias.el (mh-alias-gecos-name) (mh-alias-minibuffer-confirm-address): * lisp/mh-e/mh-comp.el (mh-forwarded-letter-subject): * lisp/mh-e/mh-speed.el (mh-speed-parse-flists-output): * lisp/mh-e/mh-utils.el (mh-collect-folder-names-filter) (mh-folder-completion-function): * lisp/minibuffer.el (completion--make-envvar-table) (completion-file-name-table, completion-flex-try-completion) (completion-flex-all-completions): * lisp/mpc.el (mpc--proc-quote-string, mpc-cmd-special-tag-p) (mpc-constraints-tag-lookup): * lisp/net/ange-ftp.el (ange-ftp-send-cmd) (ange-ftp-allow-child-lookup): * lisp/net/mailcap.el (mailcap-mime-types): * lisp/net/mairix.el (mairix-search-thread-this-article): * lisp/net/pop3.el (pop3-open-server): * lisp/net/soap-client.el (soap-decode-xs-complex-type): * lisp/net/socks.el (socks-filter): * lisp/nxml/nxml-outln.el (nxml-highlighted-qname): * lisp/nxml/rng-cmpct.el (rng-c-expand-name, rng-c-expand-datatype): * lisp/nxml/rng-uri.el (rng-uri-file-name-1): * lisp/obsolete/complete.el (partial-completion-mode) (PC-do-completion): * lisp/obsolete/longlines.el (longlines-encode-string): * lisp/obsolete/nnir.el (nnir-compose-result): * lisp/obsolete/terminal.el (te-quote-arg-for-sh): * lisp/obsolete/tpu-edt.el (tpu-check-search-case): * lisp/obsolete/url-ns.el (isPlainHostName): * lisp/pcmpl-unix.el (pcomplete/scp): * lisp/play/dunnet.el (dun-listify-string2, dun-get-path) (dun-unix-parse, dun-doassign, dun-cat, dun-batch-unix-interface): * lisp/progmodes/ebnf2ps.el: (ebnf-eps-header-footer-comment): * lisp/progmodes/gdb-mi.el (gdb-var-delete) (gdb-speedbar-expand-node, gdbmi-bnf-incomplete-record-result): * lisp/progmodes/gud.el (gud-find-expr): * lisp/progmodes/idlw-help.el (idlwave-do-context-help1): * lisp/progmodes/idlw-shell.el (idlwave-shell-mode) (idlwave-shell-filter-hidden-output, idlwave-shell-filter): * lisp/progmodes/idlwave.el (idlwave-skip-label-or-case) (idlwave-routine-info): * lisp/progmodes/octave.el (inferior-octave-completion-at-point): * lisp/progmodes/sh-script.el (sh-add-completer): * lisp/progmodes/sql.el (defun): * lisp/progmodes/xscheme.el (xscheme-process-filter): * lisp/replace.el (query-replace-compile-replacement) (map-query-replace-regexp): * lisp/shell.el (shell--command-completion-data) (shell-environment-variable-completion): * lisp/simple.el (display-message-or-buffer): * lisp/speedbar.el (speedbar-dired, speedbar-tag-file) (speedbar-tag-expand): * lisp/subr.el (split-string-and-unquote): * lisp/tar-mode.el (tar-extract): * lisp/term.el (term-command-hook, serial-read-name): * lisp/textmodes/bibtex.el (bibtex-print-help-message): * lisp/textmodes/ispell.el (ispell-lookup-words, ispell-filter) (ispell-parse-output, ispell-buffer-local-parsing): * lisp/textmodes/reftex-cite.el (reftex-do-citation): * lisp/textmodes/reftex-parse.el (reftex-notice-new): * lisp/textmodes/reftex-ref.el (reftex-show-entry): * lisp/textmodes/reftex.el (reftex-compile-variables): * lisp/textmodes/tex-mode.el (tex-send-command) (tex-start-tex, tex-append): * lisp/thingatpt.el (thing-at-point-url-at-point): * lisp/tmm.el (tmm-add-one-shortcut): * lisp/transient.el (transient-format-key): * lisp/url/url-auth.el (url-basic-auth) (url-digest-auth-directory-id-assoc): * lisp/url/url-news.el (url-news): * lisp/url/url-util.el (url-parse-query-string): * lisp/vc/vc-cvs.el (vc-cvs-parse-entry): * lisp/wid-browse.el (widget-browse-sexp): * lisp/woman.el (woman-parse-colon-path, woman-mini-help) (WoMan-getpage-in-background, woman-negative-vertical-space): * lisp/xml.el: * test/lisp/emacs-lisp/check-declare-tests.el (check-declare-tests-warn): * test/lisp/files-tests.el (files-tests-file-name-non-special-dired-compress-handler): * test/lisp/net/network-stream-tests.el (server-process-filter): * test/src/coding-tests.el (ert-test-unibyte-buffer-dos-eol-decode): Use `string-search` instead of `string-match` and `string-match-p`.
* Improve wording of recently changed documentationEli Zaretskii2021-08-061-1/+1
| | | | | | | | | * src/minibuf.c (syms_of_minibuf): * lisp/minibuffer.el (minibuffer-restore-windows): * lisp/progmodes/etags.el (etags-xref-prefer-current-file): Improve wording of doc strings. * etc/NEWS: Improve wording and format of recently added entries.
* Add function minibuffer-restore-windows (bug#45072)Juri Linkov2021-08-061-0/+10
| | | | | | | * lisp/minibuffer.el (minibuffer-restore-windows): New function that removes the completions buffer. Add it to minibuffer-exit-hook. * src/minibuf.c (read-minibuffer-restore-windows): Mention minibuffer-restore-windows.
* Fix case insensitivity in `read-file-name'Lars Ingebrigtsen2021-07-301-1/+2
| | | | | * lisp/minibuffer.el (read-file-name-default): Make `read-file-name' actually respect `read-file-name-completion-ignore-case' (bug#14340).
* Quit minibuffers without aborting kmacrosMiha Rihtaršič2021-07-201-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | * doc/lispref/commands.texi (Quitting): Document `minibuffer-quit' (Recursive Editing): Document throwing of function values to `exit'. * doc/lispref/errors.texi (Standard Errors): Document `minibuffer-quit' * lisp/minibuffer.el (minibuffer-quit-recursive-edit): New function. * lisp/simple.el (minibuffer-error-function): Do not abort keyboard macro execution if is minibuffer-quit is signaled (bug#48603). * src/data.c (syms_of_data): New error symbol `minibuffer-quit' * src/keyboard.c (recursive_edit_1): Implement throwing of function values to `exit`. In that case, the function will be called without arguments before returning from the command loop. (cmd_error): (Fcommand_error_default_function): Do not abort keyboard macro execution if minibuffer-quit is signaled. (command_loop_2): New argument HANDLERS. * src/macros.c (Fexecute_kbd_macro): Use command_loop_2 instead of command_loop_1. * src/minibuf.c (Fabort_minibuffers): Use it.
* Implement another fix for bug#49229Michael Albinus2021-07-021-0/+1
| | | | | | | | | | | * lisp/minibuffer.el (read-file-name-default): Respect remote files. (Bug#49229) * lisp/net/tramp-sh.el (tramp-sh-handle-expand-file-name): Handle special file names on MS Windows. * lisp/net/tramp.el (tramp-file-name-handler): Revert patch. (Bug#49229)
* * lisp/minibuffer.el (completion-in-region--single-word): SimplifyStefan Monnier2021-06-261-10/+5
| | | | | | | | | Remove redundant args `collection` and `predicate` which were always equal to `minibuffer-completion-table` and `minibuffer-completion-predicate` anyway. (minibuffer-complete-word): * lisp/emacs-lisp/crm.el (crm-complete-word): Simplify accordingly.
* * lisp/minibuffer.el (minibuffer--completion-prompt-end): RenameStefan Monnier2021-06-261-7/+7
|
* * lisp/minibuffer.el (completion--prompt-end): New function (bug#30668)Stefan Monnier2021-06-261-9/+14
| | | | | | (minibuffer-complete, minibuffer-force-complete-and-exit) (minibuffer-force-complete, minibuffer-complete-and-exit) (minibuffer-complete-word, minibuffer-completion-help): Use it.
* Sync overlay code in minibuffer-message and set-minibuffer-message (bug#48669)Juri Linkov2021-06-081-11/+21
| | | | | | | | * lisp/minibuffer.el (minibuffer-message): Copy more overlay positioning code from set-minibuffer-message. (minibuffer--message-overlay-pos): Mention both minibuffer-message and set-minibuffer-message in the docstring. (set-minibuffer-message): Use 'cursor t' instead of 1.
* completion-pcm--hilit-commonality: Reuse the match-data cons cellsDmitry Gutov2021-06-071-2/+3
| | | | | * lisp/minibuffer.el (completion-pcm--hilit-commonality): Reuse the match-data cons cells for better performance (bug#48841).
* Further improvements to completion-list-mode-mapGregory Heytings2021-05-251-1/+1
| | | | | | | | | | | | | | * doc/emacs/mini.texi (Completion Commands): Mention the change, and mention the 'n' and 'p' keys bound to 'next-completion' and 'previous-completion'. (bug#47699). * lisp/minibuffer.el (minibuffer-local-completion-map): Change the M-g key to M-g M-c. * lisp/simple.el (completion-list-mode-map): Change the M-g key to M-g M-c. (read-expression-map): Bind M-g M-c to read-expression-switch-to-completions. (read-expression-switch-to-completions): New function.
* Improve completion-list-mode-mapGregory Heytings2021-05-251-0/+1
| | | | | | | | | | | | | * doc/emacs/mini.texi (Completion Commands): Mention it. * lisp/minibuffer.el (minibuffer-local-completion-map): Add the M-g key for switch-to-completion (bug#47699). * lisp/simple.el (completion-list-mode-map): Make special-mode-map its parent, unbind the 'g' revert key, add the 'n' and 'p' keys for next-completion and previous-completion, and the M-g key for switch-to-minibuffer. (switch-to-minibuffer): New function.
* (minibuffer-completion-help): Add group sortingDaniel Mendler2021-05-201-6/+33
| | | | | | | | | | | | | | Sort the groups as returned by the `group-function` of the completion table depending on the value of the customizable variable `completions-group-sort`. By default `completions-group-sort` is set to nil. The variable can be set to the symbol `alphabetical` in order to configure alphabetical sorting. Furthermore, a custom sorting function can be used as value of `completions-group-sort`. * lisp/minibuffer.el (completions-group-sort): New variable. (minibuffer--group-by): Add SORT-FUN argument. (minibuffer-completion-help): Pass `completions-group-sort` to `minibuffer--group-by`.
* (completion--insert-vertical): Separate groups completelyDaniel Mendler2021-05-201-60/+48
| | | | | | | Insert the candidates vertically within the groups, but keep the groups separate using the full width group separators. * minibuffer.el (completion--insert-vertical): Adjust grouping.
* (minibuffer-completion-help): Do not check `completions-group` centrallyDaniel Mendler2021-05-201-2/+1
| | | | | | | | | The guard variable `completions-group` should be checked in each completion table individually. The guard variable `completions-detailed` variable is used in the same way. * minibuffer.el (minibuffer-completion-help): Remove check of `completions-group`.
* (completion--insert-strings): Split function; Full group title supportDaniel Mendler2021-05-201-118/+158
| | | | | | | | | | | | | Split `completion--insert-strings` into a function per completions format in order to increase readability and extensibility. This change eases the addition of more formats. Add support for group titles to the vertical and horizontal formatting functions. * minibuffer.el (completion--insert): Add new function. (completion--insert-vertical, completion--insert-horizontal, completion--insert-one-column): Extract function from `completion--insert-strings`. Use new function `completion--insert`. (completion--insert-strings): Use new insertion functions.
* (completing-read): Add `group-function` to the completion metadataDaniel Mendler2021-05-201-21/+105
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A completion table can specify a `group-function` in its metadata. The group function takes two arguments, a completion candidate and a transform argument. The group function is used to group the candidates after sorting and to enhance the completion UI with group titles. If the transform argument is nil, the function must return the title of the group to which the completion candidate belongs. The function may also return nil if the candidate does not belong to a group. If the transform argument is non-nil, the function must return the transformed candidate. For example, the transformation allows to remove a redundant part of the candidate, which is then displayed in the title. The grouping functionality is guarded by the customizable variable `completions-group` and turned off by default for the *Completions* buffer. The specific form of the `group-function` has been chosen in order to allow allocation-free grouping. This is important for completion UIs, which continously update the displayed set of candidates (Icomplete, Vertico, Ivy, etc.). Only when the transform argument is non-nil the candidate transformation is performed, which may involve a string allocation as done in the function `xref--completing-read-group`. The function `xref-show-definitions-completing-read` makes use of the `group-function`, by moving the file name prefix to the title. If grouping is enabled, the *Completions* are displayed as "linenum:summary" instead of "file:linenum:summary". This way the *Completions* buffer resembles the *Occur* buffer. * doc/lispref/minibuf.texi: Add documentation. * lisp/minibuffer.el (completion-metadata): Describe the `group-function` in the docstring. (completions-group): Add guard variable, off by default. (completions-group-format): Add variable defining the format string for the group titles. (completions-group-title): Add face used by `completions-group-format` for the group titles. (completions-group-separator): Add face used by `completions-group-format` for the group separator lines. (minibuffer--group-by): New grouping function. (minibuffer-completion-help): Use it. (display-completion-list): Add optional GROUP-FUN argument. (completion--insert-strings): Add optional GROUP-FUN argument. Insert group titles if `completions-format` is `one-column`. Transform each candidate with the GROUP-FUN. Attach the untransformed candidate to the property `completion--string`. * lisp/simple.el (choose-completion): Retrieve the untransformed completion candidate from the property `completion--string`. * lisp/progmodes/xref.el: (xref--completing-read-group): New grouping function. (xref-show-definitions-completing-read): Use it.
* Improve documentation of new behavior of 'M-y'Eli Zaretskii2021-05-171-2/+4
| | | | | | | | | | | | | | | * lisp/minibuffer.el (minibuffer-local-map): Switch the order of '\r' and '\n' bindings. * lisp/simple.el (yank-pop, read-from-kill-ring) (yank-from-kill-ring): Doc fixes. * doc/emacs/search.texi (Isearch Yank): * doc/emacs/killing.texi (Yanking): Improve the description of the new functionality of 'M-y'. * doc/lispref/text.texi (Yank Commands): Remove inaccurate description of 'M-y' in Isearch. * etc/NEWS: Improve the wording of 'M-y' entry.
* * lisp/minibuffer.el (completing-read-default): Fix bug#45474Stefan Monnier2021-05-011-9/+12
| | | | | | Set `minibuffer-completion-*` variables buffer-locally instead of using a global let-binding. This should also help make completion work correctly when multiple minibuffers are simultaneously active.
* (affixation-function): Allow only three-element list elementsDaniel Mendler2021-04-271-9/+9
| | | | | | | | | | | | | | | Restrict the definition of the `affixation-function`. The function must return a list of three element lists. Since the `affixation-function` is part of the widely used `completing-read` API a simplification is helpful for both authors of completion UIs and authors of completion tables. * doc/lispref/minibuf.texi: Update documentation. * lisp/minibuffer.el: Update documentation. * lisp/simple.el (read-extended-command--affixation): Return three-element lists. https://lists.gnu.org/archive/html/emacs-devel/2021-04/msg01193.html
* (completion-all-sorted-completions): Fix history use with boundariesDaniel Mendler2021-04-241-10/+26
| | | | | | | | | | | | Preprocess the history (and the default) through the new function `minibuffer--sort-preprocess-history` to filter out the completion base for completion tables with boundaries (in particular the file completion table). * lisp/minibuffer.el (minibuffer--sort-preprocess-history_: New function. (completion-all-sorted-completions): Use it. * test/lisp/minibuffer-tests.el (completion-all-sorted-completions): Add tests for various combinations of with/without history/base/default.
* Fix small bug in 'completion-table-subvert'.Philipp Stephani2021-04-231-1/+1
| | | | | | | | | | | | Even for a trivial underlying completion table (where the 'boundaries' action returns nil), we need to provide nontrivial boundaries so that they match the behavior of 'all-completions'. * lisp/minibuffer.el (completion-table-subvert): Return boundaries even for trivial underlying completion table. * test/lisp/minibuffer-tests.el (completion-table-subvert-test): Amend unit test to also test boundaries. While there, also test the other completion functions.
* * src/minibuf.c (Fread_no_blanks_input): Move to `minibuffer.el`Stefan Monnier2021-04-201-4/+27
| | | | | | | * src/keymap.c (syms_of_keymap): * lisp/minibuffer.el (minibuffer-local-ns-map): Move declaration to initialization. (read-no-blanks-input): Move from `minibuf.c`.
* * lisp/minibuffer.el (minibuffer-mode-map): Make it an aliasStefan Monnier2021-04-201-2/+4
| | | | | Avoid creating this "dummy" keymap by making it an alias of the parent keymap of all minibuffer keymaps.
* Introduce and use minibuffer-mode. This fixes bug #47150Alan Mackenzie2021-04-201-0/+10
| | | | | | | | | | | | | | | | | | | * lisp/minibuffer.el (minibuffer-mode): New derived mode. * src/minibuf.c (syms_of_minibuf): New DEFSYMs Qminibuffer_mode, Qminibuffer_inactive_mode, Qminibuffer_completing_file_name, Qselect_frame_set_input_focus, Qadd_to_history. (read_minibuf, set_minibuffer_mode, read_minibuf_unwind): Use the new DEFSYMs in place of continual interning. (set_minibuffer_mode): Put an active minibuffer into minibuffer-mode rather than fundamental-mode. * doc/emacs/mini.texi (Minibuffer Edit): Mention minibuffer-mode. * doc/lispref/minibuf.texi (Intro to Minibuffers): Add a paragraph about minibuffer-mode. * etc/NEWS (Incompatible Lisp Changes in Emacs 28.1): Add an entry.
* (completion-all-sorted-completions): Additional alphabetical sortingDaniel Mendler2021-04-191-19/+30
| | | | | | | | | | Even in the cases where it does not make much visible difference, it brings the benefit of making the result deterministic. * minibuffer.el (minibuffer--sort-by-length-alpha): New function. (minibuffer--sort-by-position): New function extracted from `completion-all-sorted-completions`. (completion-all-sorted-completions): Use use them.
* minibuffer.el: Use completion--message instead of minibuffer-messageDaniel Mendler2021-04-191-2/+2
| | | | | * minibuffer.el: Use completion--message consistently for the messages "Incomplete", "Sole completion" and "No completions".
* * lisp/minibuffer.el (completion-all-sorted-completions): Fix last changeStefan Monnier2021-04-191-2/+3
|
* * lisp/minibuffer.el (minibuffer--sort-by-key): New functionStefan Monnier2021-04-191-13/+9
| | | | (completion-all-sorted-completions): Use it.
* completion-all-sorted-completions: Fix sorting performance bugDaniel Mendler2021-04-191-8/+25
| | | | | | * lisp/minibuffer.el (completion-all-sorted-completions): Use hash table for sorting by history position, O(m+n*log(n)) instead of O(m*n*log(n)) with history length `m` and candidate length `n`.
* completing-read: If HIST is the symbol `t', history is not recorded.Daniel Mendler2021-04-191-1/+1
| | | | | | | | * lisp/minibuffer.el (completion-all-sorted-completions): Check if `minibuffer-history-variable` is `t` * src/minibuf.c (completing-read): Update docstring * doc/lispref/minibuf.texi: Update documentation of `read-from-minibuffer` and `completing-read`
* * lisp/minibuffer.el (completion-table-with-quoting): Fix bug#47678Stefan Monnier2021-04-121-2/+11
|
* Fix previous format-prompt change: The default can be a symbolLars Ingebrigtsen2021-03-241-1/+2
| | | | | * lisp/minibuffer.el (format-prompt): The default can also be a symbol.
* Replace "(default %s)" with 'format-prompt'Gabriel do Nascimento Ribeiro2021-03-241-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/cmuscheme.el (scheme-load-file, scheme-compile-file): * lisp/comint.el (comint-get-source): * lisp/emulation/viper-cmd.el (viper-quote-region, viper-kill-buffer) (viper-query-replace, viper-read-string-with-history): * lisp/eshell/esh-mode.el (eshell-find-tag): * lisp/gnus/gnus-sum.el (gnus-articles-to-read) (gnus-summary-search-article-forward) (gnus-summary-search-article-backward): * lisp/international/mule-cmds.el (set-input-method, toggle-input-method) (describe-input-method, set-language-environment) (describe-language-environment): * lisp/mh-e/mh-gnus.el (mh-mml-minibuffer-read-disposition): * lisp/mh-e/mh-letter.el (mh-insert-letter): * lisp/mh-e/mh-mime.el (mh-display-with-external-viewer) (mh-mime-save-parts, mh-mh-forward-message) (mh-mml-query-cryptographic-method, mh-minibuffer-read-type): * lisp/mh-e/mh-seq.el (mh-read-seq, mh-read-range): * lisp/mh-e/mh-utils.el (mh-prompt-for-folder): * lisp/progmodes/etags.el (find-tag-tag): (find-tag-noselect, find-tag, find-tag-other-window) (find-tag-other-frame, find-tag-regexp): * lisp/progmodes/idlwave.el (idlwave-find-module): * lisp/progmodes/inf-lisp.el (lisp-load-file, lisp-compile-file): * lisp/progmodes/tcl.el (tcl-load-file, tcl-restart-with-file): * lisp/progmodes/xref.el (xref--read-identifier): (xref-find-definitions, xref-find-definitions-other-window) (xref-find-definitions-other-frame, xref-find-references): * lisp/ses.el (ses-read-printer): (ses-read-cell-printer, ses-read-column-printer) (ses-read-default-printer, ses-define-local-printer): * lisp/subr.el (read-number): * lisp/term.el (term-get-source): * src/minibuf.c (read-buffer): Remove prompt suffix and use 'format-prompt'. * lisp/minibuffer.el (format-prompt): Ignore DEFAULT empty strings (bug#47286).
* Fix previous completion-pcm--optimize-pattern fixLars Ingebrigtsen2021-03-011-1/+1
| | | | | * lisp/minibuffer.el (completion-pcm--optimize-pattern): Re-fix previous change.
* Fix warning in completion-pcm--optimize-patternLars Ingebrigtsen2021-03-011-1/+1
| | | | | * lisp/minibuffer.el (completion-pcm--optimize-pattern): Remove unused variable.
* Make recursive minibuffers and recursive edits work togetherAlan Mackenzie2021-02-111-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/minibuffer.el (exit-minibuffer): When in a minibuffer, throw an error should the command loop nesting level be wrong. * src/lisp.h (minibuffer_quit_level): declare as an extern. (command_loop_level): Move definition from src/window.h * src/window.h (command_loop_level): move definition to src/lisp.h. * src/eval.c (minibuffer_quit_level): Move this variable to file level from being a static inside internal_catch. (internal_catch): Simplify the logic. * src/minibuf.c (Vcommand_loop_level_list): New variable. (move_minibuffer_onto_frame): Set the major mode of *Minibuf-0*. (Fminibuffer_innermost_command_loop_p): New primitive. (Fabort_minibuffers): Check the command loop level before throwing t to 'exit, and set minibuffer_quit_level too. (read_minibuf): New variable calling_window. Before stacking up minibuffers on the current mini-window, check that the mini-window is not the current one. Do not call choose_minibuf_frame from read_minibuf's unwinding process. Bind calling_frame and calling_window over the recursive edit. Set the new minibuffer's major mode directly. Remove the switching away from the minibuffer after the recursive edit. (get_minibuffer): Record the command loop level in new variable Vcommand_loop_level_list. No longer set the major mode of a returned minibuffer. (minibuf_c_loop_level): New function. (read_minibuf_unwind): New variables calling_frame, calling_window are unbound from the binding stack. Remove old variable `window', which could not be set reliably to the expired mini-window. The expired minibuffer is determined as the nth in the list, rather than the contents of the current or previous mini-window. Switch the current window away from the mini-window here (moved from read_minibuf).
* Allow exit-minibuffer to be called from Lisp code. Fixes bug #46373Alan Mackenzie2021-02-091-1/+3
| | | | | | | | | * lisp/minibuffer.el (exit-minibuffer): Throw the error "Not in most nested minibuffer" only when the current buffer is a minibuffer (thus the command came directly from a key binding). * doc/lispref/minibuf.texi (Minibuffer Commands): Change the documentation accordingly.
* Allow the caller to specify own face on suffix in annotation-functionJuri Linkov2021-01-301-11/+8
| | | | | | | | | | | | | | | | | | * lisp/minibuffer.el (completion--insert-strings): Don't add 'completions-annotations' face when the caller specified own face in annotation-function. Remove no-op code for 'unless prefix' branch. (completion-metadata, completion-extra-properties): Update docs of affixation-function. Suggested by Clemens <clemera@posteo.net> (bug#45780) * test/lisp/minibuffer-tests.el: Rename package name from completion-tests.el to minibuffer-tests.el. Add new test completion--insert-strings-faces. * doc/lispref/minibuf.texi (Completion Variables) (Programmed Completion): Update descriptions of annotation-function and affixation-function.
* Fix incompleteness in the implementation of minibuffer-follows-selected-frameAlan Mackenzie2021-01-101-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In particular, add a new value to the variable, and fix several bugs apparent with the implementation up till now. * doc/emacs/mini.texi (Basic Minibuffer): Add a description of the new non-nil, non-t value of minibuffer-follows-selected-frame. * doc/emacs/trouble.texi (Quitting): Add a description of how C-g handles recursive minibuffers when typed in one which isn't the most nested. * doc/lispref/minibuf.texi (Intro to Minibuffers): Add an @dfn for "active minibuffer". (Minibuffer Commands): Document that exit-minibuffer throws an error when not invoked from the innermost Minibuffer. (Recursive Mini): Amend the description of the visibility of outer level minibuffers. (Minibuffer Misc): In the description of the minibuffer hooks, replace "the minibuffer" with "a minibuffer". * etc/NEWS (Entry announcing minibuffer-follows-selected-frame): Add a description of the new non-nil, non-t value. * lisp/cus-start.el (top level): make the customize entry for minibuffer-follows-selected-frame a choice between three entries. * lisp/minibuffer.el (exit-minibuffer): throw an error when we're not in the most nested minibuffer. (top level): Bind C-g to abort-minibuffers in minibuffer-local-map. * lisp/window.el (window-deletable-p): return the symbol `frame' when (amongst other things) minibuffer-follows-selected-frame is t. * src/eval.c (internal_catch): Add a mechanism to (throw 'exit t) repeatedly when the throw currently being processed doesn't terminate the current minibuffer. * src/lisp.h (this_minibuffer_depth): New extern declaration (minibuf_level): extern declaration moved here from window.h. * src/minibuf.c (minibuffer_follows_frame, minibuf_stays_put) (minibuf_moves_frame_when_opened): New and amended functions to query the value of minibuffer-follows-selected-frame. (choose_minibuf_frame): check (minibuf > 1) in place of (minibufer > 0) at a particular place. At another place, check that an alleged frame is so and is live. Before selecting a non-miniwindow on a different frame, ensure it really is a different frame. (move_minibuffer_onto_frame): Stack up all recursive minibuffers on the target frame. Check the minibuf_window isn't in the old frame before setting that frame's miniwindow to an inactive minibuffer. (Finnermost_minibuffer_p, Fabort_minibuffers): New primitives. (this_minibuffer_depth): New function. (read_minibuf): Record the calling frame in a variable, and switch back to it after the recursive edit has terminated normally, using select-frame-set-input-focus. Stack up all the recursive minibuffers on the miniwindow where a new minibuffer is being opened. After the recursive edit, switch the selected window away from the expired minibuffer's window. (nth_minibuffer): New function. (minibuffer-follows-selected-frame): Change from a DEFVAR_BOOL to a DEFVAR_LISP. * src/window.c (decode_next_window_args): Set *minibuf to w's mini-window's content when that content is a minibuffer. * src/window.h (minibuf_level) Declaration moved from here to lisp.h.
* Update copyright year to 2021Paul Eggert2021-01-011-1/+1
| | | | Run "TZ=UTC0 admin/update-copyright".
* xref-show-definitions-completing-read: Tune up completionDmitry Gutov2020-12-291-0/+1
| | | | | | | | | | * lisp/minibuffer.el (completion-category-defaults) Use 'substring' completion style for 'xref-location' category by default. * lisp/progmodes/xref.el (xref-show-definitions-completing-read): Assign the 'xref-location' category to the completions. Pass REQUIRE-MATCH=t.
* Robustify completion match scoring for optimized patternsJoão Távora2020-12-281-21/+27
| | | | | | | | | | | | | | | | | | | | | | | | Fixes: bug#42149 The function completion-pcm--hilit-commonality, which propertizes and scores a previously confirmed match, expected its PATTERN argument to match the strings of COMPLETIONS entirely (i.e. up to the string's very end). But sometimes the ending wildcard, represented by the 'any' atom in PATTERN, is optimized away by completion-pcm--optimize-pattern. Although this is mostly benign in terms of highlighting commonality, it leads to incorrect score values. In this change, we ensure that completion-pcm--hilit-commonality is aware of this exception and isn't affected by it. We also document the function a bit better and simplify its workings. Originally reported by Dario Gjorgjevski <dario.gjorgjevski@gmail.com> * lisp/minibuffer.el (completion-pcm--hilit-commonality): Simplify. Add docstring. * lisp/minibuffer.el (completion-pcm--hilit-commonality): Add docstring
* * lisp/minibuffer.el: Avoid consecutive `any` in completion patternsStefan Monnier2020-12-281-1/+2
| | | | | | (completion-pcm--optimize-pattern): Turn multiple consecutive occurrences of `any` into just a single one. Suggested by Dario Gjorgjevski <dario.gjorgjevski@gmail.com>.
* Give affixation-function higher priority over annotation-function (bug#45234)Juri Linkov2020-12-161-6/+10
| | | | | | | | | | | | | * doc/lispref/minibuf.texi (Completion Variables) (Programmed Completion): Describe precedence rules of affixation-function and annotation-function. * lisp/minibuffer.el (completion-metadata) (completion-extra-properties): Describe precedence rules of affixation-function and annotation-function. (minibuffer-completion-help): First try to apply affixation-function, if there is no such function, try annotation-function.
* Prefer setq-local in most filesStefan Kangas2020-12-091-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/apropos.el (apropos-print): * lisp/buff-menu.el (Buffer-menu-mode): * lisp/calc/calc.el (calc-trail-buffer): * lisp/chistory.el (command-history-mode): * lisp/dabbrev.el: * lisp/dframe.el (dframe-frame-mode): * lisp/doc-view.el (doc-view-presentation-mode): * lisp/ebuff-menu.el (electric-buffer-menu-mode) (electric-buffer-update-highlight): * lisp/edmacro.el (edit-kbd-macro): * lisp/face-remap.el (buffer-face-set, buffer-face-toggle): * lisp/files.el: (find-file-noselect-1, hack-local-variables-confirm) (set-visited-file-name, revert-buffer--default): * lisp/filesets.el (filesets-spawn-external-viewer): * lisp/find-dired.el (find-dired): * lisp/find-lisp.el (find-lisp-find-dired-internal): * lisp/finder.el (finder-mode): * lisp/font-core.el (font-lock-default-function): * lisp/format.el (format-annotate-function): * lisp/help-fns.el (describe-variable): * lisp/help-mode.el (help-mode): * lisp/icomplete.el (icomplete-minibuffer-setup) (icomplete--in-region-setup): * lisp/ido.el (ido-completion-help, ido-tidy): * lisp/international/robin.el (robin-activate): * lisp/leim/quail/hangul.el (hangul-input-method-activate): * lisp/leim/quail/uni-input.el (ucs-input-activate): * lisp/man.el (Man-mode): * lisp/master.el (master-set-slave): * lisp/minibuffer.el (minibuffer-completion-help) (read-file-name-default): * lisp/outline.el (outline-minor-mode): * lisp/pcomplete.el (pcomplete-comint-setup): * lisp/proced.el (proced-mode): * lisp/recentf.el (recentf-edit-list, recentf-open-files-items): * lisp/replace.el (occur-1): * lisp/reveal.el (reveal-mode): * lisp/ruler-mode.el (ruler--save-header-line-format): * lisp/scroll-lock.el (scroll-lock-mode): * lisp/startup.el (normal-top-level, normal-splash-screen): * lisp/strokes.el (strokes-list-strokes): * lisp/thumbs.el (thumbs-insert-image, thumbs-show-thumbs-list): * lisp/tree-widget.el (tree-widget-set-theme): * lisp/window.el (read-buffer-to-switch): * lisp/xwidget.el (xwidget-webkit-begin-edit-textarea): Prefer setq-local.
* Add completion-tab-width to align prefix chars with names in read-char-by-nameJuri Linkov2020-11-271-3/+10
| | | | | | | | | | | | | | | | | * lisp/international/mule-cmds.el (mule--ucs-names-affixation): Replace mule--ucs-names-annotation to display chars in prefixes that implements two FIXME items. (read-char-by-name): Let-bind completion-tab-width to 4. Use affixation-function instead of annotation-function. * lisp/minibuffer.el (completion-tab-width): New variable. (completion--insert-strings): Align colwidth to tab positions when completion-tab-width is non-nil. * lisp/simple.el (completion-setup-function): Set tab-width to completion-tab-width when completion-tab-width is non-nil. https://lists.gnu.org/archive/html/emacs-devel/2020-11/msg01263.html