annotate doc/lispref/minibuf.texi @ 107863:594e81986a75

2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-insert-link): Find the link buffer on visible frames. (org-export-latex-default-packages-alist): hyperref must be loaded late. (org-open-file): More care with the new matching for file links. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-latex.el (org-export-latex-preprocess): Do not yet protect defined entities - these will be taken care of later. (org-export-latex-special-chars): Post-process entity replacement. (org-export-latex-fontify-headline): Do not yet protect defined entities - these will be taken care of later. (org-export-latex-tables, org-export-latex-links): Format the caption properly. * org-entities.el (org-entities-user): Fix typo. * org.el (org-prepare-agenda-buffers): Uniquify TODO keywords * org-entities.el (org-entities-user): Improve docstring. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-entities.el (org-macs): Require org-macs, to be sure that we have `declare-function' defined. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-latex.el (org-export-latex-classes): Update docstring. * org.el (org-format-latex-header): Add cookies to the header. (org-splice-latex-header): Implement placement according to cookies. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-publish.el (org-publish-aux-preprocess): Control case sensitivity. 2010-04-10 Bastien Guerry <bzg@altern.org> * org.el (org-splice-latex-header): Fix typo. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-latex.el (org-export-latex-make-header): Use `org-splice-latex-header' to build the header. (org-export-latex-classes): Update docstring. * org.el (org-splice-latex-header): New function. (org-create-formula-image): Use `org-splice-latex-header' to build the header. * org-gnus.el (org-gnus-follow-link): Handle nndoc backend. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-export-latex-packages-alist) (org-export-latex-default-packages-alist): Fix docstring to reflect the expected structure. * org-docbook.el (org-docbook-do-expand): Fix bug with variable names. (org-export-docbook-finalize-table): Make use of label for tables. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-attach.el (org-attach-commit): Split on newlines. * org.el (org-export-latex-default-packages-alist): Use list instead of cons for the entries. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-entities.el (org-entity-get-representation): Catch the case that there is not entry in the list. * org-mobile.el (org-mobile-use-encryption) (org-mobile-encryption-tempfile, org-mobile-encryption-password): New options. (org-mobile-check-setup): CHeck the encryption setup. (org-mobile-copy-agenda-files, org-mobile-sumo-agenda-command) (org-mobile-create-sumo-agenda): Use encryption code. (org-mobile-encrypt-and-move): New function. (org-mobile-encrypt-file, org-mobile-decrypt-file): New functions. (org-mobile-move-capture): Decrypt the capture file. * org.el (org-entities): Require the new file. (org-export-latex-default-packages-alist): New variable. (org-complete): Use new entity code for completion. (org-create-formula-image): Use the new packages variable. * org-latex.el (org-export-latex-classes): Remove the standard packages from the class headers. (org-export-latex-make-header): Use the new package variable. (org-export-latex-special-chars): Better regexp for entities, to support entity name that contain numbers. (org-export-latex-treat-backslash-char): Use the new entity code. * org-html.el (org-html-do-expand): Use the new entity code. * org-exp.el (org-export): Add the new export commands. (org-html-entities): Constant removed. (org-export-visible): Add the new export commands. * org-entities.el: New file. * org-docbook.el (org-docbook-do-expand): Use new entity code. * org-ascii.el (org-export-ascii-entities): New variable. (org-export-as-latin1, org-export-as-latin1-to-buffer) (org-export-as-utf8, org-export-as-utf8-to-buffer): New commands. (org-export-as-encoding): New function. (org-export-ascii-preprocess): Call `org-ascii-replace-entities'. (org-ascii-replace-entities): New function. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-html.el (org-html-level-start): Catch the case that target might be nil. 2010-04-10 Dan Davison <davison@stats.ox.ac.uk> * org.el (org-appearance): Change Customize group variable name from org-font-lock to org-appearance, and change tag from "Org Font Lock" to "Org Appearance" (org-odd-levels-only): Change Customize group variable name (org-level-color-stars-only): Change Customize group variable name (org-hide-leading-stars): Change Customize group variable name (org-hidden-keywords): Change Customize group variable name (org-fontify-done-headline): Change Customize group variable name (org-fontify-emphasized-text): Change Customize group variable name (org-fontify-whole-heading-line): Change Customize group variable name (org-highlight-latex-fragments-and-specials): Change Customize group variable name (org-hide-emphasis-markers): Change Customize group variable name (org-emphasis-alist): Change Customize group variable name (org-emphasis-regexp-components): Change Customize group variable name (org-modules): Remove mention of org-R * org-faces.el (org-faces): Change Customize group variable name 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-agenda.el (org-diary-last-run-time): New variable. (org-diary): prepare agenda buffers only if last call was some time ago. * org-html.el (org-export-html-preprocess): Replace \ref macros with a link. (org-format-org-table-html): Add the label as an anchor. * org-docbook.el (org-export-docbook-format-image): Do some formatting on captions. * org-latex.el (org-export-latex-tables, org-export-latex-links): Do some formatting on captions. * org-html.el (org-export-html-format-image) (org-format-org-table-html): Do some formatting on captions. 2010-04-10 Dan Davison <davison@stats.ox.ac.uk> * org.el (org-hidden-keywords): New customizable variable. This is a list of symbols specifying which of the special keywords #+DATE, #+AUTHOR, #+EMAIL and #+TITLE should be hidden by font lock. (org-fontify-meta-lines-and-blocks): Changes to font-lock code implementing new faces and hiding behaviour. * org-faces.el (org-document-title): New face for #+TITLE lines (org-document-info): New face for #+DATE, #+AUTHOR, #+EMAIL lines (org-document-info-keyword): New face for #+DATE, #+AUTHOR, #+EMAIL keywords 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-publish.el (org-publish-sanitize-plist): New function to rename "index" properties to "sitemap". Do this renaming globally. (org-publish-with-aux-preprocess-maybe): New macro. (org-publish-org-to-pdf, org-publish-org-to-html): Use the new macro. (org-publish-aux-preprocess) (org-publish-index-generate-theindex.inc): New function. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-table.el (org-table-align): Interpret <N> at fixed width, not as maximum width. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-export-author-info, org-export-email-info): Fix docstrings. * org-beamer.el (org-beamer-select-environment): Renamed from `org-beamer-set-environment-tag'. Improve docstring. * org-freemind.el (org-freemind-write-mm-buffer): Fix another problem with odd levels. * org-ascii.el (org-export-as-ascii): Export email only if the author wants it. * org-docbook.el (org-export-as-docbook): Export email only if the author wants it. * org-html.el (org-export-as-html): Export email only if the author wants it. * org-exp.el (org-export-email-info): New option. (org-export-plist-vars): Add entry for `org-export-email'. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-table.el (org-table-goto-line): Fix typo. 2010-04-10 Mikael Fornius <mfo@abc.se> * org.el (org-agenda-files): Typo. (org-read-agenda-file-list): Add optional argument to help `org-store-new-agenda-file-list' to remember un-expanded file names. Expand file names relative to `org-directory'. (org-store-new-agenda-file-list): Keep un-expanded file names when saving, if available. (org-agenda-files): Update documentation. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-ascii.el (org-export-as-ascii): Catch the case of exporting a buffer with no file name attached. * org.el (org-log-refile): New option. (org-log-note-headings): Add a heading for refiling. (org-startup-options): Add keywords for logging of the refile action. (org-refile): Add logging action. (org-add-log-note): Allow for refiling action. * org-agenda.el (org-agenda-bulk-action): Make sure `org-log-refile' is not `note' during a bulk action. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-map-dblocks): Use save-excursion to remember the position. * org-attach.el (org-attach-commit): Remove dependence on xargs. (org-attach-delete-one): Commit after deleting a file. * org-latex.el (org-export-latex-fontify): Do not mistake table.el borders for strike-through emphasis. * org-freemind.el (org-freemind-write-mm-buffer): Simplify the handling of odd levels. * org-agenda.el (org-agenda-todo-ignore-deadlines): Document `past' and `future' values. (org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item): Handle `past' and `future' values. * org.el (org-read-agenda-file-list): Interpret file names relative to org-directory and allow environment variables and "~". * org-latex.el (org-export-latex-special-chars): Allow a parenthesis before an exponent or subscript. 2010-04-10 Dan Davison <davison@stats.ox.ac.uk> * org-src.el (org-edit-src-exit): When returning from code edit buffer, if code block is hidden, leave point at start of #+begin_src line 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-insert-heading): Do not remove all spaces if the headline is empty. * org-indent.el (org-indent): Fix group name. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-table.el (org-table-goto-column): Fix forcing a non-existing column. (org-table-get, org-table-put, org-table-goto-line) (org-table-current-line): New functions. 2010-04-10 Jan Bcker <jan.boecker@jboecker.de> * org.el (org-open-file): Allow regular expressions in org-file-apps to capture link parameters using groups. In a command string to be executed, the parameters can be referenced using %1, %2, etc. Lisp forms can access them using (match-string n link). (org-apps-regexp-alist): Adopt the created regexp, as this is now matched against a file: link instead of the file name. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-crypt.el (org-reveal-start-hook): Add a decryption function to this hook. (org-decrypt-entries, org-encrypt-entries, org-decrypt-entry): Add docstrings. * org.el (org-point-at-end-of-empty-headline) (org-level-increment, org-get-previous-line-level): New function. (org-cycle-level): Rewritten to be independent of when this function is called. (org-in-regexps-block-p): New function. (org-reveal-start-hook): New hook. (org-reveal): Run new hook. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-latex.el (org-export-latex-keywords): Start a new paragraph after time keywords, do not add "\newline". * org-html.el (org-export-as-html): Avoid double # in href. * org.el (org-refile-get-location): Catch an invalid target specification. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-agenda.el (org-agenda-add-entry-to-org-agenda-diary-file): Make sure the behavior regarding to extracting time is consistent. 2010-04-10 Stephen Eglen <stephen@gnu.org> * org-agenda.el (org-agenda-insert-diary-extract-time): New variable. (org-agenda-add-entry-to-org-agenda-diary-file): Use this new variable rather than `org-agenda-search-headline-for-time'. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-list.el (org-fix-bullet-type): Improve cursor positioning. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-adaptive-fill-regexp-backup): New variable. (org-set-autofill-regexps): Store a backup of `adaptive-fill-regexp'. (org-adaptive-fill-function): Fix filling of comments and ordered lists. If there is no other match, till try adaptive fill. 2010-04-10 John Wiegley <jwiegley@gmail.com> * org-agenda.el (org-agenda-include-deadlines): Added new customization variable to determine whether unscheduled tasks should appear in the agenda solely because of their deadline. Default to true, which was the previous behavior (it just wasn't configurable). (org-agenda-mode-map, org-agenda-view-mode-dispatch): Bind ! in the agenda to show/hide deadline tasks. (org-agenda-menu): Added menu option for show/hide deadlines. (org-agenda-list): Make the agenda list sensitive to the value of `org-agenda-include-deadlines'. (org-agenda-toggle-deadlines): New function to toggle the value of `org-agenda-include-deadlines' and repaint the modeline indicators. (org-agenda-set-mode-name): Show "Deadlines" in the agenda modeline if deadline tasks are being displayed. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-table.el (org-table-eval-formula): Replace $# and @# by current column and row number. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-set-property, org-delete-property): Go back to prompting for the property. * org-latex.el (org-export-latex-make-header): Fully process author line. (org-export-latex-fontify-headline): Allow several arguments, not just one. (org-export-latex-fix-inputenc): Catch the error when `latexenc-coding-system-to-inputenc' is not defined. * org-agenda.el (org-agenda-skip-if-todo): New function. (org-agenda-skip-if): Add conditions for TODO keywords. (org-agenda-skip-if): Document the new todo conditions. 2010-04-10 Mikael Fornius <mfo@abc.se> * org.el (org-at-property-p): Check if we are inside a property drawer not just any drawer. (org-set-property, org-delete-property): When cursor is on a property key value pair do not prompt for property name instead use name at cursor. (org-ctrl-c-ctrl-c): Still do org-property-action when cursor is on the first line of a property drawer. (org-property-end-re): Spell check. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-export-attach-captions-and-attributes): Add the properties to the entire table, in case the first line is removed. * org-archive.el (org-archive-reversed-order): New option. (org-archive-subtree, org-archive-to-archive-sibling): Use the new option `org-archive-reversed-order'. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-agenda.el (org-agenda-entry-types): New variable. (org-agenda-list): Use `org-agenda-entry-types'. (org-agenda-custom-commands-local-options): Support for setting `org-agenda-entry-types' as an option. (org-diary): Shift some documentation from here to the variable `org-agenda-entry-types'. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-latex.el (org-export-latex-make-header): Apply macros in author field. * org-clock.el (org-clocking-buffer, org-clocking-p): New function. (org-clock-select-task, org-clock-notify-once-if-expired) (org-clock-in, org-clock-out, org-clock-cancel, org-clock-goto) (org-clock-out-if-current, org-clock-save): Use the new functions. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-docbook.el (org-export-as-docbook): Remove unnecessary newline. (org-export-as-docbook): Remove unnecessary newline. (org-export-as-docbook): Fix problem with double footnote reference in one place. * org-exp.el (org-export-format-source-code-or-example): Remove unnecessary newline. * org.el (org-deadline, org-schedule): Allow rescheduling entries with repeaters. * org-table.el (org-table-convert-refs-to-rc): Better way to catch function calls that look like references. * org.el (org-open-at-point): Get link abbreviations from reference buffer. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-table.el (org-table-convert-refs-to-rc): Do not read arctan2 as a reference. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-link-unescape): Solve issue with lower-case escapes. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-latex.el (org-export-latex-classes): Add \usepackage{latexsym} to all classes. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-html.el (org-export-as-html): Do not allow protected lines into the table of contents. * org-latex.el (org-export-latex-special-chars): Find subsequent occurrences of special characters. (org-export-latex-tables): Do not convert table-like stuff that is protected. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-list.el (org-toggle-checkbox): No errors when updating checkbox count fails because there is no heading. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-clock.el (org-clock-report-include-clocking-task): New option. (org-clock-sum): Add the current clocking task. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-cycle): Print a message when in a table.el table. (org-edit-special): Recognize the table.el context. (org-ctrl-c-ctrl-c): Print a message when in a table.el table. * org-src.el (org-at-table.el-p): Declare. (org-edit-src-code): Handle a special case for table.el editing. (org-edit-src-find-region-and-lang): Recognize the table.el context. * org-latex.el (org-export-latex-tables): Convert table.el tables. (org-export-latex-convert-table.el-table): New function. * org-html.el (org-html-expand): Fix table.el export. * org-latex.el (org-export-latex-preprocess): Protect footnotes in headings. * org-id.el (org-id-find-id-file): Fix bug when there is no hash table for the id locations. * org.el (org-read-date-analyze): Match American-style dates, like 5/30 or 5/13/7. Make sure cal-iso.el is loaded. Don't force he current year when reading ISO and American dates. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-face-from-face-or-color): New function. (org-get-todo-face, org-font-lock-add-priority-faces) (org-get-tag-face): Use `org-face-from-face-or-color'. * org-faces.el (org-todo-keyword-faces, org-priority-faces): Allow simple colors as values. (org-faces-easy-properties): New option. * org-agenda.el (org-agenda-set-mode-name): Show if the agenda is restricted, as an agenda mode. (org-agenda-fontify-priorities): Allow simple colors as values. 2010-04-10 Bastien Guerry <bzg@altern.org> * org-timer.el (org-timer-current-timer): Renamed from `org-timer-last-timer'. (org-timer-timer1, org-timer-timer2, org-timer-timer3): Removed. (org-timer-cancel-timer, org-timer-show-remaining-time) (org-timer-set-timer): Update to use only one timer. * org.el (org-set-property): Remove useless space in the prompt. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-html.el (org-export-html-style-default): Add a default style for textareas. * org-exp.el (org-export-format-source-code-or-example): Fix textarea tag. 2010-04-10 Bastien Guerry <bzg@altern.org> * org-clock.el (org-clock-current-task): New variable to store last clocked in task. (org-clock-set-current, org-clock-delete-current): New functions. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-remember.el (org-remember-apply-template): Extend comment. (org-remember-handler): Implement clock sibling filing. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-publish.el (org-publish-all, org-publish-current-file) (org-publish-current-project): When called with prefix argument FORCE, also rebuild the validation file list. * org-latex.el (org-export-latex-preprocess): Protect footnotes in section headings. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-html.el (org-export-as-html-and-open): Kill product buffer if the user wants that. * org-latex.el (org-export-as-pdf-and-open): Kill product buffer if the user wants that. * org-exp.el (org-export-kill-product-buffer-when-displayed): New option. * org-agenda.el (org-batch-agenda-csv): Use the time property instead of the `time-of-day' property. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-timer.el (org-timer-start-hook, org-timer-stop-hook) (org-timer-pause-hook, org-timer-set-hook) (org-timer-cancel-hook): New hooks. (org-timer-start): Run `org-timer-start-hook'. (org-timer-pause-or-continue): Run `org-timer-pause-hook'. (org-timer-stop): Run `org-timer-stop-hook'. (org-timer-cancel-timers): Run `org-timer-cancel-hook'. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-reveal): Double prefix arg shows the subtree of the parent. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-agenda.el (org-search-view): Fix bug with searching full words in headlines in search view. (org-agenda-skip-deadline-prewarning-if-scheduled): New option. (org-agenda-get-deadlines): Suppress pre-warning if the entry is scheduled (if the user configures it so. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-hide-archived-subtrees): Don't jump to end of subtree if the match was not in a headline. (org-inside-latex-macro-p): Allow more complex arguments. (org-emphasize): Protect against use at end of buffer. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-agenda.el (org-agenda-align-tags): Avoid side effects on text properties. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-agenda.el (org-agenda-todo-ignore-scheduled): More allowed values. (org-agenda-todo-ignore-scheduled) (org-agenda-todo-ignore-deadlines): More control with different allowed values. (org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item): Honor the new option settings. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-get-location): Make sure the selection buffer is shown in the current frame. * org-ascii.el (org-export-ascii-table-widen-columns): New option. (org-export-ascii-preprocess): Realign tables to remove narrowing if `org-export-ascii-table-widen-columns' is set. * org-table.el (org-table-do-narrow): New variable. (org-table-align): Narrow only if `org-table-do-narrow' is t. * org.el (org-deadline, org-schedule): Allow updating if the relevant time stamp does not have a repeater, i.e. do not require that no time stamp has a repeater. * org-agenda.el (org-agenda-align-tags): Don't add a face to the new white space before the tags. * org-latex.el (org-export-as-latex): Do nit require the buffer to be visiting a file when only exporting to a buffer or string. (org-export-latex-fix-inputenc): Only save the buffer is there is a file name attached to it. 2010-04-10 Dan Davison <davison@stats.ox.ac.uk> * org-src.el (org-edit-src-exit): Widen before exiting edit buffers 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-fontify-meta-lines-and-blocks): Honor `org-fontify-quote-and-verse-blocks'. * org-faces.el (org-fontify-quote-and-verse-blocks): New option. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-open-at-point): Also check for text property org-linked-text before offering collected links. 2010-04-10 Stephen Eglen <stephen@gnu.org> * org-agenda.el (org-agenda-add-entry-to-org-agenda-diary-file): Optionally extract time specification from text and add to the timestamp. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-html-entities): Fix typo. * org-latex.el (org-export-latex-make-header): Use \providecommand to make sure the \alert macro is defined. * org.el (org-format-latex-signal-error) (org-create-formula-image): Use `org-format-latex-signal-error'. 2010-04-10 Stephen Eglen <stephen@gnu.org> * org.el (org-store-link): For dired buffers, use default-directory as link name if dired-get-filename returns nil. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-export-concatenate-multiline-links): The for protectedness at beginning of match. * org-latex.el (org-export-latex-fix-inputenc): Never leave the AUTO as a coding system, instead default to utf8. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-block-todo-from-children-or-siblings-or-parent) (org-block-todo-from-checkboxes): Respect the local variable value when deciding if blocking should be active. * org-latex.el (org-export-latex-make-header): Define the align macro if it is not yet defined. * org-agenda.el (org-agenda-insert-diary-make-new-entry): Call `org-insert-heading' with the INVISIBLE-OK argument. * org-mac-message.el (org-mac-message-insert-flagged): Call `org-insert-heading' with the INVISIBLE-OK argument. * org.el (org-insert-heading): New argument INVISIBLE-OK. * org-agenda.el (org-agenda-view-mode-dispatch): Improve the prompt message. * org-html.el (org-html-level-start): Use the `html-container-class' text property to set an additional class for an outline container. * org-exp.el (org-export-remember-html-container-classes): New function. (org-export-preprocess-string): Call `org-export-remember-html-container-classes'. * org.el (org-cycle): Mention level cycling in the docstring. (org-default-properties): Add new property HTML_CONTAINER_CLASS. * org-remember.el (org-remember-apply-template): Do file insertion first. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-habit.el (org-habit-insert-consistency-graphs): Fix a problem with mis-aligned graphs when showing habits. 2010-04-10 Mikael Fornius <mfo@abc.se> * org.el (org-assign-fast-keys): Prefer keys used in keyword name when assigning. Begin using numerical characters when all in name is used up. This is to spare alphanumeric characters for better match with other keywords. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-export-preprocess-hook): Improve documentation. * org-latex.el (org-export-latex-preprocess): More consistent conversion and protection of the words LaTeX and TeX. (org-export-latex-fontify-headline, org-export-latex-preprocess): Allow angle brackets in commands, for beamer. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-clock.el (org-clock-in): Improve the look of the clock line by formatting links. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-latex.el (org-export-latex-classes): Use AUTO as the place holder string for the coding system. And improve the documentation. (org-export-latex-fix-inputenc): Only modify the coding system if it is given by the placeholder AUTO. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-clock.el (org-task-overrun-text): New option. (org-task-overrun, org-clock-update-period): New variables. (org-clock-get-clock-string, org-clock-update-mode-line): Mark overrun clock. (org-clock-notify-once-if-expired): Check if clock is overrun. * org-faces.el: New face `org-mode-line-clock-overrun'. 2010-04-10 Jan Bcker <jan.boecker@jboecker.de> * org.el (org-narrow-to-subtree): Position the end of the narrowed region before the line with the next heading, to prevent the user from prepending text to the next headline. 2010-04-10 Stephen Eglen <stephen@gnu.org> * org-agenda.el (org-get-time-of-day): Use org-agenda-time-leading-zero to allow leading zero (rather than space) for times. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-agenda.el (org-agenda-diary-entry-in-org-file): Make sure org-datetree.el is loaded. * org-datetree.el: autoload `org-datetree-find-day-create' * org-latex.el (org-export-latex-hyperref-format): New option. (org-export-latex-links): Use `org-export-latex-hyperref-format'. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-ctags.el (org-ctags-enable): Change order of functions. (org-ctags-create-tags): Add wildcard to file name expansion. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-entry-properties): Fix some important bugs. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-link-unescape, org-link-escape): Only use hexlify if the table is not explicitly given. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-clock.el (org-clock-out-when-done): Allow a list of keywords as value. (org-clock-out-if-current): Work with the new list value of `org-clock-out-when-done'. (org-clock-out, org-clock-out-if-current): Avoid circular logic between clocking out and state changes. * org-ctags.el (org-ctags-path-to-ctags): Better system-type test. * org-latex.el (org-export-latex-treat-backslash-char): Do not by accident protect a character that is before a backslash. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-agenda.el (org-diary-class): Use `org-order-calendar-date-args'. * org.el (org-order-calendar-date-args): New function. * org-exp.el (org-export-target-internal-links): Check for protectedness after the first bracket. * org.el (org-entry-properties): Don't match wrong-case TODO keywords. * org-agenda.el (org-agenda-schedule, org-agenda-deadline): Document that ARG is passed through to remove the date. (org-agenda-bulk-action): Accept prefix arg and pass it on. Do not read a date when the user has given a `C-u' prefix. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-agenda.el (org-agenda-fix-displayed-tags): Fix bug when all tags are hidden. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-latex.el (org-export-latex-fix-inputenc): New function. (org-export-latex-inputenc-alist): New option. * org-exp.el (org-export): New key SPC to publish enclosing subtree. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-indent.el (org-indent-add-properties): Catch case when there is no headline in the buffer. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-html-entities): Add checkmark symbol. * org-ascii.el (org-export-ascii-preprocess): Protect targets in verbatim code for ASCII export. * org.el (org-update-statistics-cookies): Also see checkboxes in ordered lists. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-agenda.el (org-agenda-view-mode-dispatch): Define the `L' key. * org-beamer.el (org-beamer-amend-header): Change the location where `org-beamer-header-extra' is inserted. * org.el (org-compute-latex-and-specials-regexp): Don't do BIND just for computing this regexp. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-beamer.el (org-beamer-frame-default-options): New option. (org-beamer-sectioning): Use default options if the user does not have defined any. (org-beamer-fix-toc): Put a frame around the table of contents. * org-exp.el (org-export-remove-comment-blocks-and-subtrees): Make sure case-folding works well when processing comment stuff. * org-latex.el (org-export-latex-after-save-hook): New hook. (org-export-as-latex): Run the new hook. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-beamer.el (org-beamer-environments-default): Add the note environments. (org-beamer-after-initial-vars): Allow several BEAMER_HEADER_EXTRA lines and collect and combine the content. (org-beamer-after-initial-vars): Check for note tags and make sure they will be seen like a property. * org.el (org-offer-links-in-entry): Fix bug when there is a single link. * org-exp.el (org-export): Make sure the mark is activated, also when `transient-mark-mode' is off. * org-agenda.el (org-agenda-search-view-always-boolean): New option. (org-agenda-search-view-search-words-only): Obsolete variable, is now an alias for `org-agenda-search-view-always-boolean'. (org-agenda-search-view-force-full-words): New option. (org-search-view): Improve docstring, and implement a better logic for Boolean and phrase searches. (org-agenda-last-search-view-search-was-boolean): New variable. (org-agenda-manipulate-query): Consider the type of the last search when modifying the search string. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-latex.el (org-export-as-latex): Do the first letbind in the right moment. * org-agenda.el (org-get-entries-from-diary): Add the new face to these entries. * org-faces.el (org-agenda-diary): New face. * org.el (org-make-link-regexps): Allow regexp-special characters in link types. (org-open-file): When in-emacs is `system', also force system opening, like when the value was `(16)'. (org-update-statistics-cookies): Handle entries without children. * org-exp.el (org-export-preprocess-before-normalizing-links-hook): New hook. (org-export-preprocess-string): Run the new hook. * org.el (org-offer-links-in-entry): Make RET open all links. * org-html.el (org-export-as-html): Remove any leftover display properties in the html file. * org-wl.el (org-wl-store-link): Work-around for format bug with text properties. * org-habit.el (org-habit-insert-consistency-graphs): Turn off invisibility while adding the graphs. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-remember.el (org-select-remember-template): Use C letter to customize remember templates. * org-agenda.el (org-agenda-bulk-mark, org-agenda-bulk-unmark): Move cursor to next visible line. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-beamer.el (org-beamer-sectioning): Leave columns environment by specifying 0 or 1 for column width. (org-beamer-column-widths): Make 0 stand for 0.0. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-export-mark-radio-links): Don't match inside <<target>>. * org.el (org-format-latex-header-extra): New variable. (org-format-latex): Set org-format-latex-header-extra from in-buffer stuff. (org-format-latex): Add org-format-latex-header-extra to the variables on which image creation depends. (org-create-formula-image): Add the header stuff from in-buffer settings. (org-read-date-analyze): Base the analysis for future preference on NOW, not on the default date. * org-inlinetask.el (org-inlinetask-export-handler): Add CSS class for TODO keyword in inline tasks. * org.el (org-log-note-headings): New headings for removing deadline or scheduling date. (org-deadline, org-schedule): Arrange for logging when removing a date. (org-add-log-note): Handle deadline and scheduling removal. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-export-visible): Add LaTeX/pdf export. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-agenda.el (org-diary-class): New function. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-latex.el (org-export-latex-preprocess): Do process the text of a radio target. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-entry-properties): Add TIMESTAMP properties back in. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-all-time-keywords): New variable. (org-set-regexps-and-options): Set `org-all-time-keywords'. (org-entry-blocked-p): New function. (org-special-properties): Add BLOCKED as a new special property. (org-entry-properties): New optional argument SPECIFIC, only parse for this property when it is specified. (org-entry-get): Pass a SPECIFIC argument to `org-entry-properties'. * org-latex.el (org-export-as-latex): Preprocess TEXT as well. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-latex.el (org-export-latex-tables): No forced line end if there is no caption. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-html-entities): Add Euro symbols from Marvosym package. * org-latex.el (org-export-latex-tables): Only add a caption when macro in in longtable environments if one has been defined. * org-html.el (org-export-as-html): Only take title from buffer if not exporting body-only. * org-latex.el (org-export-latex-preprocess): Better version of the regular expression for protecting LaTeX macros. (org-export-latex-preprocess): Start searching for macros to protect from beginning of buffer. * org-exp.el (org-export-target-internal-links): Check for protectedness earlier in the string. * org-agenda.el (org-agenda-highlight-todo): Match TODO keywords case sensitively. * org-id.el (org-id-store-link): Match TODO keywords case sensitively. * org.el (org-heading-components, org-get-outline-path) (org-display-outline-path): Match TODO keywords case sensitively. * org-latex.el (org-export-as-latex): Ignore read-only properties. * org-exp.el (org-export-preprocess-string): Remove any `read-only' properties. * org-agenda.el (org-agenda-inactive-leader): New option. (org-agenda-get-timestamps): Use `org-agenda-inactive-leader'. (org-tags-view): Prompt for matcher if MATCH is an empty string. (org-todo-list): Prompt for matcher if ARG is an empty string. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-open-link-functions): New hook. (org-open-at-point): Run `org-open-link-functions'. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-agenda.el (org-agenda-date-prompt): Allow inactive time stamps as well. * org.el (org-inhibit-startup-visibility-stuff): New variable. (org-mode): Don't do startup visibility if inhibited. (org-outline-overlay-data, org-set-outline-overlay-data): New functions. (org-save-outline-visibility): New macro. (org-log-note-headings): Document that one should not change the `state' note format. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-make-link-regexps): Capture link path into a group. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-beamer.el (org-beamer-after-initial-vars): Do not overwrite the options plist. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-startup-with-beamer-mode): New option. (org-property-changed-functions) (org-property-allowed-value-functions): New hooks. (org-entry-put, org-property-get-allowed-values): Run the new hooks. (org-property-next-allowed-value): Run the new hooks. * org-exp.el (org-export-select-backend-specific-text): Add the special beamer tags. * org-beamer.el (org-export-preprocess-before-selecting-backend-code-hook): New file. * org-latex.el (org-export-latex-after-initial-vars-hook): New hook. (org-export-as-latex): Run `org-export-latex-after-initial-vars-hook'. (org-export-latex-format-toc-function) (org-export-latex-make-header): Call `org-export-latex-format-toc-function'. * org.el (org-fill-template): Make template searches case sensitive. * org-exp.el (org-export): Use "1" as a sign to export only the subtree. * org-colview-xemacs.el (org-columns-edit-value): Use org-unrestricted property. * org-colview.el (org-columns-edit-value): Use org-unrestricted property. * org.el (org-compute-property-at-point): Set org-unrestricted text property if the list contains ":ETC". (org-insert-property-drawer): Use org-unrestricted property. * org-exp.el (org-export-preprocess-before-selecting-backend-code-hook): New hook. (org-export-preprocess-string): Run `org-export-preprocess-before-selecting-backend-code-hook'. * org-xoxo.el (org-export-as-xoxo): Run `org-export-first-hook'. * org-latex.el (org-export-region-as-latex): Run `org-export-first-hook'. * org-html.el (org-export-as-html): Run `org-export-first-hook'. * org-docbook.el (org-export-as-docbook): Run `org-export-first-hook'. * org-ascii.el (org-export-as-ascii): Run `org-export-first-hook'. * org-exp.el (org-export-first-hook): New hook. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-list.el (org-previous-item): Exit at the beginning of the buffer. * org-id.el (org-id-locations-save): Only write the id locations if any are defined. * org-archive.el (org-archive-all-done): Make this work in a file with org-odd-levels-only set. * org.el (org-get-refile-targets): Catch the case when a buffer has no file. * org-latex.el (org-export-as-latex): Cleanup forced line ends where they are not needed. (org-export-latex-subcontent): Remove unnecessary newlines. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-latex.el (org-export-latex-make-header): Remove \obeylines. (org-export-latex-fontify): Fix regexp bug that takes special care of protecting the right boundary characters in emphasis matches. (org-export-latex-preprocess): Allow multiple arguments to latex macros. * org.el (org-make-link-regexps): Use John Gruber's regexp for urls. * org-macs.el (org-re): Interpret :punct: in regexps. * org-exp.el (org-export-replace-src-segments-and-examples): Also take the final newline after the END line. * org.el (org-clean-visibility-after-subtree-move): Only fix entries that are not entirely invisible already. (org-insert-link): Respect org-link-file-path-type for "docview:" links in addition to "file:" links. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-export-format-source-code-or-example): Avoid additional extra white lines in LaTeX. * org-list.el (org-list-parse-list): Leave empty lines after the list, don't consider them as part of the list. * org-mobile.el (org-mobile-sumo-agenda-command): Allow tagstodo searches. * org-clock.el (org-clock-select-task): Convert integer to character for XEmacs. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-clock.el (org-clock-resolve): Make reading a char XEmacs compatible. 2010-04-10 Tassilo Horn <tassilo@member.fsf.org> * org.el (org-complete-tags-always-offer-all-agenda-tags): New variable. (org-set-tags): Use it. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-list.el (org-empty-line-terminates-plain-lists): Update docstring. * org.el (org-format-latex): Fix link creation for processed latex snippets. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-footnote.el (org-footnote-normalize): Protect replacement text. * org.el (org-inside-latex-macro-p): Save match data. 2010-04-10 Jan Bcker <jan.boecker@jboecker.de> * org-docview.el: New file. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-latex.el (org-export-latex-class-options): New variable. (org-export-latex-set-initial-vars): Use the class options. * org.el (org-forward-same-level): Stop at headings that start with an invisible character. (org-additional-option-like-keywords): Add LaTeX_CLASS_OPTIONS. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-footnote.el (org-footnote-normalize): Don't take optional arguments in LaTeX macros as footnotes. * org.el (org-inside-latex-macro-p): New function. * org-latex.el (org-latex-to-pdf-process): Change customization group to `org-export-pdf'. * org-agenda.el (org-agenda-get-blocks): Look at time string also on days after the first one. * org.el (org-insert-heading): Also check for item before assuming before-first-heading condition. * org-latex.el (org-latex-to-pdf-process): Fix typo in group tag. (org-export-pdf-logfiles): New option. (org-export-as-pdf): Use `org-export-pdf-logfiles'. (org-export-pdf-logfiles): Fix customization type. * org.el (org-insert-link): Improve error message when there is no default link to select with RET. * org-agenda.el (org-agenda-filter-by-tag): Use char argument from parameter list. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-latex.el (org-export-latex-parse-global) (org-export-latex-parse-content) (org-export-latex-parse-subcontent): Use `org-re-search-forward-unprotected'. (org-export-as-pdf): Remove log files produced by XeTeX. * org-macs.el (org-re-search-forward-unprotected): New function. 2010-04-10 James TD Smith <ahktenzero@mohorovi.cc> * org-colview.el (org-agenda-colview-summarize): Sort out some confusion between properties and titles, which resulted in agenda summaries not working if a title was set for a column. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-mobile.el (org-mobile-agendas): New option. (org-mobile-sumo-agenda-command): Select the right agendas. * org-latex.el (org-export-latex-format-image): Preserve the original-indentation property. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-clock.el (org-clock-insert-selection-line): Catch error when an old tasks no longer exists. * org-latex.el (org-export-as-pdf): Remove also the .idx file. (org-export-as-pdf): Don't remove the old PDF file before making the new one. * org-mouse.el (org-mouse-end-headline, org-mouse-insert-item) (org-mouse-context-menu): Use `org-looking-back'. * org.el (org-cycle-level): Use `org-looking-back'. * org-list.el (org-cycle-item-indentation): Use `org-looking-back'. * org-compat.el (org-looking-back): New function. * org.el (org-insert-heading): Catch before-first-headline when inserting a headline. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-latex.el (org-export-latex-format-image): Indent figure environment, so that it does not interrupt plain list. * org.el (org-open-at-point): Allow long link descriptions. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-html.el (org-export-as-html): Remove empty lines at the beginning of the exported text. 2010-04-15 Carsten Dominik <carsten.dominik@gmail.com> * org.texi (LaTeX and PDF export): Add a footnote about xetex. (LaTeX/PDF export commands): Section renamed and moved. (Sectioning structure): Update. (References): New use case for field coordinates. (The export dispatcher): Renamed from ASCII export. (Setting up the staging area): Document the availability of encryption for MobileOrg. (Images and tables): Document how to reference labels. (Index entries): New section. (Generating an index): New section. (Column width and alignment): Document that <N> now means a fixed width, not a maximum width. (Publishing options): Document the :email option. (Beamer class export): Fix bug in the BEAMER example. (Refiling notes): Document refile logging. (In-buffer settings): Document refile logging keywords. (Drawers): Document `C-c C-z' command. (Agenda commands): Mention the alternative key `C-c C-z'. (Special properties): Document the BLOCKED property. (The spreadsheet): Mention the formula editor. (References): Document field coordinates. (Publishing action): Correct the documentation for the publishing function. (The date/time prompt): Document that we accept dates like month/day/year. (Cooperation): Document the changes in table.el support. (Faces for TODO keywords, Faces for TODO keywords) (Priorities): Document the easy colors. (Visibility cycling): Document the new double prefix arg for `org-reveal'. (Cooperation): Remember.el is part of Emacs. (Clean view): Mention that `wrap-prefix' is also set by org-indent-mode. (Agenda commands): Add information about prefix args to scheduling and deadline commands. (Search view): Point to the docstring of `org-search-view' for more details. (Agenda commands): Document that `>' prompts for a date. (Setting tags): Document variable org-complete-tags-always-offer-all-agenda-tags. (Column attributes): Cross-reference special properties.
author Carsten Dominik <carsten.dominik@gmail.com>
date Thu, 15 Apr 2010 12:11:52 +0200
parents 1d1d5d9bd884
children 7da3761e3cdf
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
84087
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1 @c -*-texinfo-*-
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2 @c This is part of the GNU Emacs Lisp Reference Manual.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
3 @c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2001, 2002,
106815
1d1d5d9bd884 Add 2010 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 106681
diff changeset
4 @c 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
84087
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
5 @c See the file elisp.texi for copying conditions.
84116
0ba80d073e27 (setfilename): Go up one more level to ../../info.
Glenn Morris <rgm@gnu.org>
parents: 84087
diff changeset
6 @setfilename ../../info/minibuf
84087
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
7 @node Minibuffers, Command Loop, Read and Print, Top
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
8 @chapter Minibuffers
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
9 @cindex arguments, reading
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
10 @cindex complex arguments
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
11 @cindex minibuffer
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
12
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
13 A @dfn{minibuffer} is a special buffer that Emacs commands use to
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
14 read arguments more complicated than the single numeric prefix
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
15 argument. These arguments include file names, buffer names, and
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
16 command names (as in @kbd{M-x}). The minibuffer is displayed on the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
17 bottom line of the frame, in the same place as the echo area
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
18 (@pxref{The Echo Area}), but only while it is in use for reading an
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
19 argument.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
20
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
21 @menu
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
22 * Intro to Minibuffers:: Basic information about minibuffers.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
23 * Text from Minibuffer:: How to read a straight text string.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
24 * Object from Minibuffer:: How to read a Lisp object or expression.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
25 * Minibuffer History:: Recording previous minibuffer inputs
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
26 so the user can reuse them.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
27 * Initial Input:: Specifying initial contents for the minibuffer.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
28 * Completion:: How to invoke and customize completion.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
29 * Yes-or-No Queries:: Asking a question with a simple answer.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
30 * Multiple Queries:: Asking a series of similar questions.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
31 * Reading a Password:: Reading a password from the terminal.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
32 * Minibuffer Commands:: Commands used as key bindings in minibuffers.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
33 * Minibuffer Contents:: How such commands access the minibuffer text.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
34 * Minibuffer Windows:: Operating on the special minibuffer windows.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
35 * Recursive Mini:: Whether recursive entry to minibuffer is allowed.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
36 * Minibuffer Misc:: Various customization hooks and variables.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
37 @end menu
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
38
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
39 @node Intro to Minibuffers
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
40 @section Introduction to Minibuffers
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
41
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
42 In most ways, a minibuffer is a normal Emacs buffer. Most operations
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
43 @emph{within} a buffer, such as editing commands, work normally in a
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
44 minibuffer. However, many operations for managing buffers do not apply
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
45 to minibuffers. The name of a minibuffer always has the form @w{@samp{
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
46 *Minibuf-@var{number}*}}, and it cannot be changed. Minibuffers are
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
47 displayed only in special windows used only for minibuffers; these
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
48 windows always appear at the bottom of a frame. (Sometimes frames have
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
49 no minibuffer window, and sometimes a special kind of frame contains
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
50 nothing but a minibuffer window; see @ref{Minibuffers and Frames}.)
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
51
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
52 The text in the minibuffer always starts with the @dfn{prompt string},
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
53 the text that was specified by the program that is using the minibuffer
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
54 to tell the user what sort of input to type. This text is marked
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
55 read-only so you won't accidentally delete or change it. It is also
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
56 marked as a field (@pxref{Fields}), so that certain motion functions,
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
57 including @code{beginning-of-line}, @code{forward-word},
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
58 @code{forward-sentence}, and @code{forward-paragraph}, stop at the
102700
bcd6e16781e5 (Intro to Minibuffers): Remove long-obsolete info
Chong Yidong <cyd@stupidchicken.com>
parents: 102624
diff changeset
59 boundary between the prompt and the actual text.
84087
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
60
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
61 The minibuffer's window is normally a single line; it grows
102700
bcd6e16781e5 (Intro to Minibuffers): Remove long-obsolete info
Chong Yidong <cyd@stupidchicken.com>
parents: 102624
diff changeset
62 automatically if the contents require more space. You can explicitly
bcd6e16781e5 (Intro to Minibuffers): Remove long-obsolete info
Chong Yidong <cyd@stupidchicken.com>
parents: 102624
diff changeset
63 resize it temporarily with the window sizing commands; it reverts to
bcd6e16781e5 (Intro to Minibuffers): Remove long-obsolete info
Chong Yidong <cyd@stupidchicken.com>
parents: 102624
diff changeset
64 its normal size when the minibuffer is exited. You can resize it
bcd6e16781e5 (Intro to Minibuffers): Remove long-obsolete info
Chong Yidong <cyd@stupidchicken.com>
parents: 102624
diff changeset
65 permanently by using the window sizing commands in the frame's other
bcd6e16781e5 (Intro to Minibuffers): Remove long-obsolete info
Chong Yidong <cyd@stupidchicken.com>
parents: 102624
diff changeset
66 window, when the minibuffer is not active. If the frame contains just
bcd6e16781e5 (Intro to Minibuffers): Remove long-obsolete info
Chong Yidong <cyd@stupidchicken.com>
parents: 102624
diff changeset
67 a minibuffer, you can change the minibuffer's size by changing the
84087
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
68 frame's size.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
69
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
70 Use of the minibuffer reads input events, and that alters the values
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
71 of variables such as @code{this-command} and @code{last-command}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
72 (@pxref{Command Loop Info}). Your program should bind them around the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
73 code that uses the minibuffer, if you do not want that to change them.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
74
102700
bcd6e16781e5 (Intro to Minibuffers): Remove long-obsolete info
Chong Yidong <cyd@stupidchicken.com>
parents: 102624
diff changeset
75 Under some circumstances, a command can use a minibuffer even if
bcd6e16781e5 (Intro to Minibuffers): Remove long-obsolete info
Chong Yidong <cyd@stupidchicken.com>
parents: 102624
diff changeset
76 there is an active minibuffer; such minibuffers are called a
bcd6e16781e5 (Intro to Minibuffers): Remove long-obsolete info
Chong Yidong <cyd@stupidchicken.com>
parents: 102624
diff changeset
77 @dfn{recursive minibuffer}. The first minibuffer is named
102703
d856a0c3b3a7 * minibuf.texi (Intro to Minibuffers): Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents: 102700
diff changeset
78 @w{@samp{ *Minibuf-0*}}. Recursive minibuffers are named by
102700
bcd6e16781e5 (Intro to Minibuffers): Remove long-obsolete info
Chong Yidong <cyd@stupidchicken.com>
parents: 102624
diff changeset
79 incrementing the number at the end of the name. (The names begin with
bcd6e16781e5 (Intro to Minibuffers): Remove long-obsolete info
Chong Yidong <cyd@stupidchicken.com>
parents: 102624
diff changeset
80 a space so that they won't show up in normal buffer lists.) Of
bcd6e16781e5 (Intro to Minibuffers): Remove long-obsolete info
Chong Yidong <cyd@stupidchicken.com>
parents: 102624
diff changeset
81 several recursive minibuffers, the innermost (or most recently
bcd6e16781e5 (Intro to Minibuffers): Remove long-obsolete info
Chong Yidong <cyd@stupidchicken.com>
parents: 102624
diff changeset
82 entered) is the active minibuffer. We usually call this ``the''
bcd6e16781e5 (Intro to Minibuffers): Remove long-obsolete info
Chong Yidong <cyd@stupidchicken.com>
parents: 102624
diff changeset
83 minibuffer. You can permit or forbid recursive minibuffers by setting
bcd6e16781e5 (Intro to Minibuffers): Remove long-obsolete info
Chong Yidong <cyd@stupidchicken.com>
parents: 102624
diff changeset
84 the variable @code{enable-recursive-minibuffers}, or by putting
102703
d856a0c3b3a7 * minibuf.texi (Intro to Minibuffers): Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents: 102700
diff changeset
85 properties of that name on command symbols (@xref{Recursive Mini}.)
84087
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
86
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
87 Like other buffers, a minibuffer uses a local keymap
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
88 (@pxref{Keymaps}) to specify special key bindings. The function that
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
89 invokes the minibuffer also sets up its local map according to the job
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
90 to be done. @xref{Text from Minibuffer}, for the non-completion
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
91 minibuffer local maps. @xref{Completion Commands}, for the minibuffer
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
92 local maps for completion.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
93
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
94 When Emacs is running in batch mode, any request to read from the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
95 minibuffer actually reads a line from the standard input descriptor that
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
96 was supplied when Emacs was started.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
97
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
98 @node Text from Minibuffer
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
99 @section Reading Text Strings with the Minibuffer
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
100
102700
bcd6e16781e5 (Intro to Minibuffers): Remove long-obsolete info
Chong Yidong <cyd@stupidchicken.com>
parents: 102624
diff changeset
101 The most basic primitive for minibuffer input is
bcd6e16781e5 (Intro to Minibuffers): Remove long-obsolete info
Chong Yidong <cyd@stupidchicken.com>
parents: 102624
diff changeset
102 @code{read-from-minibuffer}, which can be used to read either a string
bcd6e16781e5 (Intro to Minibuffers): Remove long-obsolete info
Chong Yidong <cyd@stupidchicken.com>
parents: 102624
diff changeset
103 or a Lisp object in textual form. The function @code{read-regexp} is
bcd6e16781e5 (Intro to Minibuffers): Remove long-obsolete info
Chong Yidong <cyd@stupidchicken.com>
parents: 102624
diff changeset
104 used for reading regular expressions (@pxref{Regular Expressions}),
bcd6e16781e5 (Intro to Minibuffers): Remove long-obsolete info
Chong Yidong <cyd@stupidchicken.com>
parents: 102624
diff changeset
105 which are a special kind of string. There are also specialized
bcd6e16781e5 (Intro to Minibuffers): Remove long-obsolete info
Chong Yidong <cyd@stupidchicken.com>
parents: 102624
diff changeset
106 functions for reading commands, variables, file names, etc.@:
bcd6e16781e5 (Intro to Minibuffers): Remove long-obsolete info
Chong Yidong <cyd@stupidchicken.com>
parents: 102624
diff changeset
107 (@pxref{Completion}).
84087
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
108
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
109 In most cases, you should not call minibuffer input functions in the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
110 middle of a Lisp function. Instead, do all minibuffer input as part of
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
111 reading the arguments for a command, in the @code{interactive}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
112 specification. @xref{Defining Commands}.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
113
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
114 @defun read-from-minibuffer prompt-string &optional initial-contents keymap read hist default inherit-input-method
102700
bcd6e16781e5 (Intro to Minibuffers): Remove long-obsolete info
Chong Yidong <cyd@stupidchicken.com>
parents: 102624
diff changeset
115 This function is the most general way to get input from the
84087
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
116 minibuffer. By default, it accepts arbitrary text and returns it as a
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
117 string; however, if @var{read} is non-@code{nil}, then it uses
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
118 @code{read} to convert the text into a Lisp object (@pxref{Input
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
119 Functions}).
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
120
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
121 The first thing this function does is to activate a minibuffer and
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
122 display it with @var{prompt-string} as the prompt. This value must be a
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
123 string. Then the user can edit text in the minibuffer.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
124
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
125 When the user types a command to exit the minibuffer,
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
126 @code{read-from-minibuffer} constructs the return value from the text in
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
127 the minibuffer. Normally it returns a string containing that text.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
128 However, if @var{read} is non-@code{nil}, @code{read-from-minibuffer}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
129 reads the text and returns the resulting Lisp object, unevaluated.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
130 (@xref{Input Functions}, for information about reading.)
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
131
85662
2eb0abeec9da Minor clarifications in previous change.
Richard M. Stallman <rms@gnu.org>
parents: 85522
diff changeset
132 The argument @var{default} specifies default values to make available
2eb0abeec9da Minor clarifications in previous change.
Richard M. Stallman <rms@gnu.org>
parents: 85522
diff changeset
133 through the history commands. It should be a string, a list of
2eb0abeec9da Minor clarifications in previous change.
Richard M. Stallman <rms@gnu.org>
parents: 85522
diff changeset
134 strings, or @code{nil}. The string or strings become the minibuffer's
2eb0abeec9da Minor clarifications in previous change.
Richard M. Stallman <rms@gnu.org>
parents: 85522
diff changeset
135 ``future history,'' available to the user with @kbd{M-n}.
2eb0abeec9da Minor clarifications in previous change.
Richard M. Stallman <rms@gnu.org>
parents: 85522
diff changeset
136
94530
61f7b39f5e96 (Text from Minibuffer): Document a list of default values for `read-from-minibuffer'.
Juri Linkov <juri@jurta.org>
parents: 94180
diff changeset
137 If @var{read} is non-@code{nil}, then @var{default} is also used
61f7b39f5e96 (Text from Minibuffer): Document a list of default values for `read-from-minibuffer'.
Juri Linkov <juri@jurta.org>
parents: 94180
diff changeset
138 as the input to @code{read}, if the user enters empty input.
61f7b39f5e96 (Text from Minibuffer): Document a list of default values for `read-from-minibuffer'.
Juri Linkov <juri@jurta.org>
parents: 94180
diff changeset
139 If @var{default} is a list of strings, the first string is used as the input.
61f7b39f5e96 (Text from Minibuffer): Document a list of default values for `read-from-minibuffer'.
Juri Linkov <juri@jurta.org>
parents: 94180
diff changeset
140 If @var{default} is @code{nil}, empty input results in an @code{end-of-file} error.
61f7b39f5e96 (Text from Minibuffer): Document a list of default values for `read-from-minibuffer'.
Juri Linkov <juri@jurta.org>
parents: 94180
diff changeset
141 However, in the usual case (where @var{read} is @code{nil}),
61f7b39f5e96 (Text from Minibuffer): Document a list of default values for `read-from-minibuffer'.
Juri Linkov <juri@jurta.org>
parents: 94180
diff changeset
142 @code{read-from-minibuffer} ignores @var{default} when the user enters
61f7b39f5e96 (Text from Minibuffer): Document a list of default values for `read-from-minibuffer'.
Juri Linkov <juri@jurta.org>
parents: 94180
diff changeset
143 empty input and returns an empty string, @code{""}. In this respect,
61f7b39f5e96 (Text from Minibuffer): Document a list of default values for `read-from-minibuffer'.
Juri Linkov <juri@jurta.org>
parents: 94180
diff changeset
144 it differs from all the other minibuffer input functions in this chapter.
84087
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
145
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
146 If @var{keymap} is non-@code{nil}, that keymap is the local keymap to
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
147 use in the minibuffer. If @var{keymap} is omitted or @code{nil}, the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
148 value of @code{minibuffer-local-map} is used as the keymap. Specifying
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
149 a keymap is the most important way to customize the minibuffer for
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
150 various applications such as completion.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
151
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
152 The argument @var{hist} specifies which history list variable to use
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
153 for saving the input and for history commands used in the minibuffer.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
154 It defaults to @code{minibuffer-history}. @xref{Minibuffer History}.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
155
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
156 If the variable @code{minibuffer-allow-text-properties} is
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
157 non-@code{nil}, then the string which is returned includes whatever text
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
158 properties were present in the minibuffer. Otherwise all the text
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
159 properties are stripped when the value is returned.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
160
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
161 If the argument @var{inherit-input-method} is non-@code{nil}, then the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
162 minibuffer inherits the current input method (@pxref{Input Methods}) and
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
163 the setting of @code{enable-multibyte-characters} (@pxref{Text
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
164 Representations}) from whichever buffer was current before entering the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
165 minibuffer.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
166
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
167 Use of @var{initial-contents} is mostly deprecated; we recommend using
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
168 a non-@code{nil} value only in conjunction with specifying a cons cell
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
169 for @var{hist}. @xref{Initial Input}.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
170 @end defun
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
171
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
172 @defun read-string prompt &optional initial history default inherit-input-method
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
173 This function reads a string from the minibuffer and returns it. The
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
174 arguments @var{prompt}, @var{initial}, @var{history} and
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
175 @var{inherit-input-method} are used as in @code{read-from-minibuffer}.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
176 The keymap used is @code{minibuffer-local-map}.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
177
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
178 The optional argument @var{default} is used as in
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
179 @code{read-from-minibuffer}, except that, if non-@code{nil}, it also
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
180 specifies a default value to return if the user enters null input. As
85662
2eb0abeec9da Minor clarifications in previous change.
Richard M. Stallman <rms@gnu.org>
parents: 85522
diff changeset
181 in @code{read-from-minibuffer} it should be a string, a list of
2eb0abeec9da Minor clarifications in previous change.
Richard M. Stallman <rms@gnu.org>
parents: 85522
diff changeset
182 strings, or @code{nil} which is equivalent to an empty string. When
2eb0abeec9da Minor clarifications in previous change.
Richard M. Stallman <rms@gnu.org>
parents: 85522
diff changeset
183 @var{default} is a string, that string is the default value. When it
2eb0abeec9da Minor clarifications in previous change.
Richard M. Stallman <rms@gnu.org>
parents: 85522
diff changeset
184 is a list of strings, the first string is the default value. (All
2eb0abeec9da Minor clarifications in previous change.
Richard M. Stallman <rms@gnu.org>
parents: 85522
diff changeset
185 these strings are available to the user in the ``future minibuffer
2eb0abeec9da Minor clarifications in previous change.
Richard M. Stallman <rms@gnu.org>
parents: 85522
diff changeset
186 history.'')
84087
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
187
85662
2eb0abeec9da Minor clarifications in previous change.
Richard M. Stallman <rms@gnu.org>
parents: 85522
diff changeset
188 This function works by calling the
84087
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
189 @code{read-from-minibuffer} function:
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
190
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
191 @smallexample
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
192 @group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
193 (read-string @var{prompt} @var{initial} @var{history} @var{default} @var{inherit})
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
194 @equiv{}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
195 (let ((value
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
196 (read-from-minibuffer @var{prompt} @var{initial} nil nil
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
197 @var{history} @var{default} @var{inherit})))
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
198 (if (and (equal value "") @var{default})
85522
25264f468203 (Text from Minibuffer, Minibuffer Completion, High-Level Completion):
Juri Linkov <juri@jurta.org>
parents: 84116
diff changeset
199 (if (consp @var{default}) (car @var{default}) @var{default})
84087
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
200 value))
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
201 @end group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
202 @end smallexample
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
203 @end defun
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
204
98842
0cd40c64e0f2 (Text from Minibuffer): Fix description of `read-regexp'.
Eli Zaretskii <eliz@gnu.org>
parents: 98828
diff changeset
205 @defun read-regexp prompt &optional default-value
98815
9cbd69c7bb9d (Text from Minibuffer): Document `read-regexp'.
Eli Zaretskii <eliz@gnu.org>
parents: 94530
diff changeset
206 This function reads a regular expression as a string from the
9cbd69c7bb9d (Text from Minibuffer): Document `read-regexp'.
Eli Zaretskii <eliz@gnu.org>
parents: 94530
diff changeset
207 minibuffer and returns it. The argument @var{prompt} is used as in
9cbd69c7bb9d (Text from Minibuffer): Document `read-regexp'.
Eli Zaretskii <eliz@gnu.org>
parents: 94530
diff changeset
208 @code{read-from-minibuffer}. The keymap used is
9cbd69c7bb9d (Text from Minibuffer): Document `read-regexp'.
Eli Zaretskii <eliz@gnu.org>
parents: 94530
diff changeset
209 @code{minibuffer-local-map}, and @code{regexp-history} is used as the
9cbd69c7bb9d (Text from Minibuffer): Document `read-regexp'.
Eli Zaretskii <eliz@gnu.org>
parents: 94530
diff changeset
210 history list (@pxref{Minibuffer History, regexp-history}).
9cbd69c7bb9d (Text from Minibuffer): Document `read-regexp'.
Eli Zaretskii <eliz@gnu.org>
parents: 94530
diff changeset
211
98842
0cd40c64e0f2 (Text from Minibuffer): Fix description of `read-regexp'.
Eli Zaretskii <eliz@gnu.org>
parents: 98828
diff changeset
212 The optional argument @var{default-value} specifies a default value to
0cd40c64e0f2 (Text from Minibuffer): Fix description of `read-regexp'.
Eli Zaretskii <eliz@gnu.org>
parents: 98828
diff changeset
213 return if the user enters null input; it should be a string, or
0cd40c64e0f2 (Text from Minibuffer): Fix description of `read-regexp'.
Eli Zaretskii <eliz@gnu.org>
parents: 98828
diff changeset
214 @code{nil} which is equivalent to an empty string.
0cd40c64e0f2 (Text from Minibuffer): Fix description of `read-regexp'.
Eli Zaretskii <eliz@gnu.org>
parents: 98828
diff changeset
215
0cd40c64e0f2 (Text from Minibuffer): Fix description of `read-regexp'.
Eli Zaretskii <eliz@gnu.org>
parents: 98828
diff changeset
216 In addition, @code{read-regexp} collects a few useful candidates for
0cd40c64e0f2 (Text from Minibuffer): Fix description of `read-regexp'.
Eli Zaretskii <eliz@gnu.org>
parents: 98828
diff changeset
217 input and passes them to @code{read-from-minibuffer}, to make them
0cd40c64e0f2 (Text from Minibuffer): Fix description of `read-regexp'.
Eli Zaretskii <eliz@gnu.org>
parents: 98828
diff changeset
218 available to the user as the ``future minibuffer history list''
0cd40c64e0f2 (Text from Minibuffer): Fix description of `read-regexp'.
Eli Zaretskii <eliz@gnu.org>
parents: 98828
diff changeset
219 (@pxref{Minibuffer History, future list,, emacs, The GNU Emacs
0cd40c64e0f2 (Text from Minibuffer): Fix description of `read-regexp'.
Eli Zaretskii <eliz@gnu.org>
parents: 98828
diff changeset
220 Manual}). These candidates are:
98815
9cbd69c7bb9d (Text from Minibuffer): Document `read-regexp'.
Eli Zaretskii <eliz@gnu.org>
parents: 94530
diff changeset
221
9cbd69c7bb9d (Text from Minibuffer): Document `read-regexp'.
Eli Zaretskii <eliz@gnu.org>
parents: 94530
diff changeset
222 @itemize @minus
9cbd69c7bb9d (Text from Minibuffer): Document `read-regexp'.
Eli Zaretskii <eliz@gnu.org>
parents: 94530
diff changeset
223 @item
98911
3fcf0a4ef659 (Text from Minibuffer): Lower-case Word to word.
Juri Linkov <juri@jurta.org>
parents: 98897
diff changeset
224 The word or symbol at point.
98815
9cbd69c7bb9d (Text from Minibuffer): Document `read-regexp'.
Eli Zaretskii <eliz@gnu.org>
parents: 94530
diff changeset
225 @item
9cbd69c7bb9d (Text from Minibuffer): Document `read-regexp'.
Eli Zaretskii <eliz@gnu.org>
parents: 94530
diff changeset
226 The last regexp used in an incremental search.
9cbd69c7bb9d (Text from Minibuffer): Document `read-regexp'.
Eli Zaretskii <eliz@gnu.org>
parents: 94530
diff changeset
227 @item
9cbd69c7bb9d (Text from Minibuffer): Document `read-regexp'.
Eli Zaretskii <eliz@gnu.org>
parents: 94530
diff changeset
228 The last string used in an incremental search.
9cbd69c7bb9d (Text from Minibuffer): Document `read-regexp'.
Eli Zaretskii <eliz@gnu.org>
parents: 94530
diff changeset
229 @item
9cbd69c7bb9d (Text from Minibuffer): Document `read-regexp'.
Eli Zaretskii <eliz@gnu.org>
parents: 94530
diff changeset
230 The last string or pattern used in query-replace commands.
9cbd69c7bb9d (Text from Minibuffer): Document `read-regexp'.
Eli Zaretskii <eliz@gnu.org>
parents: 94530
diff changeset
231 @end itemize
9cbd69c7bb9d (Text from Minibuffer): Document `read-regexp'.
Eli Zaretskii <eliz@gnu.org>
parents: 94530
diff changeset
232
9cbd69c7bb9d (Text from Minibuffer): Document `read-regexp'.
Eli Zaretskii <eliz@gnu.org>
parents: 94530
diff changeset
233 This function works by calling the @code{read-from-minibuffer}
9cbd69c7bb9d (Text from Minibuffer): Document `read-regexp'.
Eli Zaretskii <eliz@gnu.org>
parents: 94530
diff changeset
234 function, after computing the list of defaults as described above.
9cbd69c7bb9d (Text from Minibuffer): Document `read-regexp'.
Eli Zaretskii <eliz@gnu.org>
parents: 94530
diff changeset
235 @end defun
9cbd69c7bb9d (Text from Minibuffer): Document `read-regexp'.
Eli Zaretskii <eliz@gnu.org>
parents: 94530
diff changeset
236
84087
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
237 @defvar minibuffer-allow-text-properties
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
238 If this variable is @code{nil}, then @code{read-from-minibuffer} strips
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
239 all text properties from the minibuffer input before returning it.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
240 This variable also affects @code{read-string}. However,
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
241 @code{read-no-blanks-input} (see below), as well as
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
242 @code{read-minibuffer} and related functions (@pxref{Object from
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
243 Minibuffer,, Reading Lisp Objects With the Minibuffer}), and all
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
244 functions that do minibuffer input with completion, discard text
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
245 properties unconditionally, regardless of the value of this variable.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
246 @end defvar
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
247
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
248 @defvar minibuffer-local-map
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
249 This
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
250 @anchor{Definition of minibuffer-local-map}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
251 @c avoid page break at anchor; work around Texinfo deficiency
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
252 is the default local keymap for reading from the minibuffer. By
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
253 default, it makes the following bindings:
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
254
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
255 @table @asis
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
256 @item @kbd{C-j}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
257 @code{exit-minibuffer}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
258
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
259 @item @key{RET}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
260 @code{exit-minibuffer}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
261
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
262 @item @kbd{C-g}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
263 @code{abort-recursive-edit}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
264
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
265 @item @kbd{M-n}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
266 @itemx @key{DOWN}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
267 @code{next-history-element}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
268
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
269 @item @kbd{M-p}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
270 @itemx @key{UP}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
271 @code{previous-history-element}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
272
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
273 @item @kbd{M-s}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
274 @code{next-matching-history-element}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
275
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
276 @item @kbd{M-r}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
277 @code{previous-matching-history-element}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
278 @end table
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
279 @end defvar
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
280
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
281 @c In version 18, initial is required
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
282 @c Emacs 19 feature
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
283 @defun read-no-blanks-input prompt &optional initial inherit-input-method
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
284 This function reads a string from the minibuffer, but does not allow
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
285 whitespace characters as part of the input: instead, those characters
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
286 terminate the input. The arguments @var{prompt}, @var{initial}, and
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
287 @var{inherit-input-method} are used as in @code{read-from-minibuffer}.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
288
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
289 This is a simplified interface to the @code{read-from-minibuffer}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
290 function, and passes the value of the @code{minibuffer-local-ns-map}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
291 keymap as the @var{keymap} argument for that function. Since the keymap
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
292 @code{minibuffer-local-ns-map} does not rebind @kbd{C-q}, it @emph{is}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
293 possible to put a space into the string, by quoting it.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
294
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
295 This function discards text properties, regardless of the value of
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
296 @code{minibuffer-allow-text-properties}.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
297
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
298 @smallexample
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
299 @group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
300 (read-no-blanks-input @var{prompt} @var{initial})
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
301 @equiv{}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
302 (let (minibuffer-allow-text-properties)
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
303 (read-from-minibuffer @var{prompt} @var{initial} minibuffer-local-ns-map))
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
304 @end group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
305 @end smallexample
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
306 @end defun
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
307
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
308 @defvar minibuffer-local-ns-map
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
309 This built-in variable is the keymap used as the minibuffer local keymap
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
310 in the function @code{read-no-blanks-input}. By default, it makes the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
311 following bindings, in addition to those of @code{minibuffer-local-map}:
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
312
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
313 @table @asis
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
314 @item @key{SPC}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
315 @cindex @key{SPC} in minibuffer
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
316 @code{exit-minibuffer}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
317
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
318 @item @key{TAB}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
319 @cindex @key{TAB} in minibuffer
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
320 @code{exit-minibuffer}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
321
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
322 @item @kbd{?}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
323 @cindex @kbd{?} in minibuffer
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
324 @code{self-insert-and-exit}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
325 @end table
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
326 @end defvar
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
327
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
328 @node Object from Minibuffer
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
329 @section Reading Lisp Objects with the Minibuffer
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
330
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
331 This section describes functions for reading Lisp objects with the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
332 minibuffer.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
333
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
334 @defun read-minibuffer prompt &optional initial
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
335 This function reads a Lisp object using the minibuffer, and returns it
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
336 without evaluating it. The arguments @var{prompt} and @var{initial} are
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
337 used as in @code{read-from-minibuffer}.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
338
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
339 This is a simplified interface to the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
340 @code{read-from-minibuffer} function:
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
341
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
342 @smallexample
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
343 @group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
344 (read-minibuffer @var{prompt} @var{initial})
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
345 @equiv{}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
346 (let (minibuffer-allow-text-properties)
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
347 (read-from-minibuffer @var{prompt} @var{initial} nil t))
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
348 @end group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
349 @end smallexample
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
350
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
351 Here is an example in which we supply the string @code{"(testing)"} as
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
352 initial input:
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
353
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
354 @smallexample
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
355 @group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
356 (read-minibuffer
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
357 "Enter an expression: " (format "%s" '(testing)))
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
358
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
359 ;; @r{Here is how the minibuffer is displayed:}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
360 @end group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
361
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
362 @group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
363 ---------- Buffer: Minibuffer ----------
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
364 Enter an expression: (testing)@point{}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
365 ---------- Buffer: Minibuffer ----------
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
366 @end group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
367 @end smallexample
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
368
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
369 @noindent
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
370 The user can type @key{RET} immediately to use the initial input as a
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
371 default, or can edit the input.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
372 @end defun
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
373
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
374 @defun eval-minibuffer prompt &optional initial
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
375 This function reads a Lisp expression using the minibuffer, evaluates
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
376 it, then returns the result. The arguments @var{prompt} and
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
377 @var{initial} are used as in @code{read-from-minibuffer}.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
378
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
379 This function simply evaluates the result of a call to
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
380 @code{read-minibuffer}:
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
381
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
382 @smallexample
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
383 @group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
384 (eval-minibuffer @var{prompt} @var{initial})
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
385 @equiv{}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
386 (eval (read-minibuffer @var{prompt} @var{initial}))
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
387 @end group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
388 @end smallexample
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
389 @end defun
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
390
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
391 @defun edit-and-eval-command prompt form
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
392 This function reads a Lisp expression in the minibuffer, and then
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
393 evaluates it. The difference between this command and
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
394 @code{eval-minibuffer} is that here the initial @var{form} is not
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
395 optional and it is treated as a Lisp object to be converted to printed
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
396 representation rather than as a string of text. It is printed with
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
397 @code{prin1}, so if it is a string, double-quote characters (@samp{"})
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
398 appear in the initial text. @xref{Output Functions}.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
399
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
400 The first thing @code{edit-and-eval-command} does is to activate the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
401 minibuffer with @var{prompt} as the prompt. Then it inserts the printed
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
402 representation of @var{form} in the minibuffer, and lets the user edit it.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
403 When the user exits the minibuffer, the edited text is read with
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
404 @code{read} and then evaluated. The resulting value becomes the value
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
405 of @code{edit-and-eval-command}.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
406
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
407 In the following example, we offer the user an expression with initial
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
408 text which is a valid form already:
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
409
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
410 @smallexample
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
411 @group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
412 (edit-and-eval-command "Please edit: " '(forward-word 1))
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
413
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
414 ;; @r{After evaluation of the preceding expression,}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
415 ;; @r{the following appears in the minibuffer:}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
416 @end group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
417
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
418 @group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
419 ---------- Buffer: Minibuffer ----------
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
420 Please edit: (forward-word 1)@point{}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
421 ---------- Buffer: Minibuffer ----------
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
422 @end group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
423 @end smallexample
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
424
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
425 @noindent
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
426 Typing @key{RET} right away would exit the minibuffer and evaluate the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
427 expression, thus moving point forward one word.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
428 @code{edit-and-eval-command} returns @code{nil} in this example.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
429 @end defun
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
430
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
431 @node Minibuffer History
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
432 @section Minibuffer History
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
433 @cindex minibuffer history
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
434 @cindex history list
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
435
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
436 A @dfn{minibuffer history list} records previous minibuffer inputs so
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
437 the user can reuse them conveniently. A history list is actually a
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
438 symbol, not a list; it is a variable whose value is a list of strings
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
439 (previous inputs), most recent first.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
440
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
441 There are many separate history lists, used for different kinds of
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
442 inputs. It's the Lisp programmer's job to specify the right history
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
443 list for each use of the minibuffer.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
444
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
445 You specify the history list with the optional @var{hist} argument
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
446 to either @code{read-from-minibuffer} or @code{completing-read}. Here
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
447 are the possible values for it:
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
448
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
449 @table @asis
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
450 @item @var{variable}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
451 Use @var{variable} (a symbol) as the history list.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
452
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
453 @item (@var{variable} . @var{startpos})
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
454 Use @var{variable} (a symbol) as the history list, and assume that the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
455 initial history position is @var{startpos} (a nonnegative integer).
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
456
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
457 Specifying 0 for @var{startpos} is equivalent to just specifying the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
458 symbol @var{variable}. @code{previous-history-element} will display
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
459 the most recent element of the history list in the minibuffer. If you
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
460 specify a positive @var{startpos}, the minibuffer history functions
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
461 behave as if @code{(elt @var{variable} (1- @var{STARTPOS}))} were the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
462 history element currently shown in the minibuffer.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
463
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
464 For consistency, you should also specify that element of the history
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
465 as the initial minibuffer contents, using the @var{initial} argument
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
466 to the minibuffer input function (@pxref{Initial Input}).
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
467 @end table
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
468
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
469 If you don't specify @var{hist}, then the default history list
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
470 @code{minibuffer-history} is used. For other standard history lists,
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
471 see below. You can also create your own history list variable; just
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
472 initialize it to @code{nil} before the first use.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
473
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
474 Both @code{read-from-minibuffer} and @code{completing-read} add new
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
475 elements to the history list automatically, and provide commands to
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
476 allow the user to reuse items on the list. The only thing your program
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
477 needs to do to use a history list is to initialize it and to pass its
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
478 name to the input functions when you wish. But it is safe to modify the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
479 list by hand when the minibuffer input functions are not using it.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
480
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
481 Emacs functions that add a new element to a history list can also
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
482 delete old elements if the list gets too long. The variable
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
483 @code{history-length} specifies the maximum length for most history
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
484 lists. To specify a different maximum length for a particular history
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
485 list, put the length in the @code{history-length} property of the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
486 history list symbol. The variable @code{history-delete-duplicates}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
487 specifies whether to delete duplicates in history.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
488
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
489 @defun add-to-history history-var newelt &optional maxelt keep-all
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
490 This function adds a new element @var{newelt}, if it isn't the empty
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
491 string, to the history list stored in the variable @var{history-var},
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
492 and returns the updated history list. It limits the list length to
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
493 the value of @var{maxelt} (if non-@code{nil}) or @code{history-length}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
494 (described below). The possible values of @var{maxelt} have the same
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
495 meaning as the values of @code{history-length}.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
496
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
497 Normally, @code{add-to-history} removes duplicate members from the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
498 history list if @code{history-delete-duplicates} is non-@code{nil}.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
499 However, if @var{keep-all} is non-@code{nil}, that says not to remove
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
500 duplicates, and to add @var{newelt} to the list even if it is empty.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
501 @end defun
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
502
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
503 @defvar history-add-new-input
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
504 If the value of this variable is @code{nil}, standard functions that
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
505 read from the minibuffer don't add new elements to the history list.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
506 This lets Lisp programs explicitly manage input history by using
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
507 @code{add-to-history}. By default, @code{history-add-new-input} is
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
508 set to a non-@code{nil} value.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
509 @end defvar
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
510
103273
c32ec20d0ab5 * abbrevs.texi (Abbrev Mode): abbrev-mode is an option.
Martin Rudalics <rudalics@gmx.at>
parents: 103264
diff changeset
511 @defopt history-length
84087
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
512 The value of this variable specifies the maximum length for all
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
513 history lists that don't specify their own maximum lengths. If the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
514 value is @code{t}, that means there no maximum (don't delete old
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
515 elements). The value of @code{history-length} property of the history
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
516 list variable's symbol, if set, overrides this variable for that
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
517 particular history list.
103273
c32ec20d0ab5 * abbrevs.texi (Abbrev Mode): abbrev-mode is an option.
Martin Rudalics <rudalics@gmx.at>
parents: 103264
diff changeset
518 @end defopt
84087
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
519
103273
c32ec20d0ab5 * abbrevs.texi (Abbrev Mode): abbrev-mode is an option.
Martin Rudalics <rudalics@gmx.at>
parents: 103264
diff changeset
520 @defopt history-delete-duplicates
84087
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
521 If the value of this variable is @code{t}, that means when adding a
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
522 new history element, all previous identical elements are deleted.
103273
c32ec20d0ab5 * abbrevs.texi (Abbrev Mode): abbrev-mode is an option.
Martin Rudalics <rudalics@gmx.at>
parents: 103264
diff changeset
523 @end defopt
84087
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
524
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
525 Here are some of the standard minibuffer history list variables:
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
526
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
527 @defvar minibuffer-history
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
528 The default history list for minibuffer history input.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
529 @end defvar
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
530
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
531 @defvar query-replace-history
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
532 A history list for arguments to @code{query-replace} (and similar
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
533 arguments to other commands).
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
534 @end defvar
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
535
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
536 @defvar file-name-history
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
537 A history list for file-name arguments.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
538 @end defvar
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
539
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
540 @defvar buffer-name-history
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
541 A history list for buffer-name arguments.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
542 @end defvar
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
543
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
544 @defvar regexp-history
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
545 A history list for regular expression arguments.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
546 @end defvar
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
547
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
548 @defvar extended-command-history
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
549 A history list for arguments that are names of extended commands.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
550 @end defvar
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
551
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
552 @defvar shell-command-history
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
553 A history list for arguments that are shell commands.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
554 @end defvar
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
555
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
556 @defvar read-expression-history
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
557 A history list for arguments that are Lisp expressions to evaluate.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
558 @end defvar
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
559
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
560 @node Initial Input
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
561 @section Initial Input
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
562
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
563 Several of the functions for minibuffer input have an argument called
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
564 @var{initial} or @var{initial-contents}. This is a mostly-deprecated
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
565 feature for specifying that the minibuffer should start out with
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
566 certain text, instead of empty as usual.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
567
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
568 If @var{initial} is a string, the minibuffer starts out containing the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
569 text of the string, with point at the end, when the user starts to
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
570 edit the text. If the user simply types @key{RET} to exit the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
571 minibuffer, it will use the initial input string to determine the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
572 value to return.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
573
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
574 @strong{We discourage use of a non-@code{nil} value for
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
575 @var{initial}}, because initial input is an intrusive interface.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
576 History lists and default values provide a much more convenient method
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
577 to offer useful default inputs to the user.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
578
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
579 There is just one situation where you should specify a string for an
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
580 @var{initial} argument. This is when you specify a cons cell for the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
581 @var{hist} or @var{history} argument. @xref{Minibuffer History}.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
582
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
583 @var{initial} can also be a cons cell of the form @code{(@var{string}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
584 . @var{position})}. This means to insert @var{string} in the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
585 minibuffer but put point at @var{position} within the string's text.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
586
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
587 As a historical accident, @var{position} was implemented
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
588 inconsistently in different functions. In @code{completing-read},
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
589 @var{position}'s value is interpreted as origin-zero; that is, a value
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
590 of 0 means the beginning of the string, 1 means after the first
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
591 character, etc. In @code{read-minibuffer}, and the other
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
592 non-completion minibuffer input functions that support this argument,
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
593 1 means the beginning of the string 2 means after the first character,
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
594 etc.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
595
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
596 Use of a cons cell as the value for @var{initial} arguments is
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
597 deprecated in user code.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
598
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
599 @node Completion
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
600 @section Completion
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
601 @cindex completion
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
602
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
603 @dfn{Completion} is a feature that fills in the rest of a name
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
604 starting from an abbreviation for it. Completion works by comparing the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
605 user's input against a list of valid names and determining how much of
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
606 the name is determined uniquely by what the user has typed. For
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
607 example, when you type @kbd{C-x b} (@code{switch-to-buffer}) and then
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
608 type the first few letters of the name of the buffer to which you wish
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
609 to switch, and then type @key{TAB} (@code{minibuffer-complete}), Emacs
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
610 extends the name as far as it can.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
611
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
612 Standard Emacs commands offer completion for names of symbols, files,
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
613 buffers, and processes; with the functions in this section, you can
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
614 implement completion for other kinds of names.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
615
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
616 The @code{try-completion} function is the basic primitive for
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
617 completion: it returns the longest determined completion of a given
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
618 initial string, with a given set of strings to match against.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
619
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
620 The function @code{completing-read} provides a higher-level interface
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
621 for completion. A call to @code{completing-read} specifies how to
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
622 determine the list of valid names. The function then activates the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
623 minibuffer with a local keymap that binds a few keys to commands useful
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
624 for completion. Other functions provide convenient simple interfaces
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
625 for reading certain kinds of names with completion.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
626
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
627 @menu
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
628 * Basic Completion:: Low-level functions for completing strings.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
629 (These are too low level to use the minibuffer.)
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
630 * Minibuffer Completion:: Invoking the minibuffer with completion.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
631 * Completion Commands:: Minibuffer commands that do completion.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
632 * High-Level Completion:: Convenient special cases of completion
103831
20b45d53642e (Completion): End menu description with period.
Glenn Morris <rgm@gnu.org>
parents: 103335
diff changeset
633 (reading buffer name, file name, etc.).
98897
3bc1332e6140 (Reading File Names): Document `read-shell-command' and
Eli Zaretskii <eliz@gnu.org>
parents: 98842
diff changeset
634 * Reading File Names:: Using completion to read file names and
3bc1332e6140 (Reading File Names): Document `read-shell-command' and
Eli Zaretskii <eliz@gnu.org>
parents: 98842
diff changeset
635 shell commands.
102624
6ddfdbfcd361 (Completion Styles): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 102616
diff changeset
636 * Completion Styles:: Specifying rules for performing completion.
84087
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
637 * Programmed Completion:: Writing your own completion-function.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
638 @end menu
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
639
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
640 @node Basic Completion
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
641 @subsection Basic Completion Functions
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
642
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
643 The completion functions @code{try-completion},
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
644 @code{all-completions} and @code{test-completion} have nothing in
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
645 themselves to do with minibuffers. We describe them in this chapter
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
646 so as to keep them near the higher-level completion features that do
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
647 use the minibuffer.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
648
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
649 If you store a completion alist in a variable, you should mark the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
650 variable as ``risky'' with a non-@code{nil}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
651 @code{risky-local-variable} property.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
652
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
653 @defun try-completion string collection &optional predicate
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
654 This function returns the longest common substring of all possible
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
655 completions of @var{string} in @var{collection}. The value of
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
656 @var{collection} must be a list of strings or symbols, an alist, an
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
657 obarray, a hash table, or a function that implements a virtual set of
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
658 strings (see below).
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
659
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
660 Completion compares @var{string} against each of the permissible
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
661 completions specified by @var{collection}; if the beginning of the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
662 permissible completion equals @var{string}, it matches. If no permissible
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
663 completions match, @code{try-completion} returns @code{nil}. If only
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
664 one permissible completion matches, and the match is exact, then
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
665 @code{try-completion} returns @code{t}. Otherwise, the value is the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
666 longest initial sequence common to all the permissible completions that
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
667 match.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
668
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
669 If @var{collection} is an alist (@pxref{Association Lists}), the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
670 permissible completions are the elements of the alist that are either
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
671 strings, symbols, or conses whose @sc{car} is a string or symbol.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
672 Symbols are converted to strings using @code{symbol-name}. Other
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
673 elements of the alist are ignored. (Remember that in Emacs Lisp, the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
674 elements of alists do not @emph{have} to be conses.) In particular, a
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
675 list of strings or symbols is allowed, even though we usually do not
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
676 think of such lists as alists.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
677
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
678 @cindex obarray in completion
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
679 If @var{collection} is an obarray (@pxref{Creating Symbols}), the names
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
680 of all symbols in the obarray form the set of permissible completions. The
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
681 global variable @code{obarray} holds an obarray containing the names of
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
682 all interned Lisp symbols.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
683
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
684 Note that the only valid way to make a new obarray is to create it
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
685 empty and then add symbols to it one by one using @code{intern}.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
686 Also, you cannot intern a given symbol in more than one obarray.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
687
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
688 If @var{collection} is a hash table, then the keys that are strings
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
689 are the possible completions. Other keys are ignored.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
690
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
691 You can also use a symbol that is a function as @var{collection}. Then
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
692 the function is solely responsible for performing completion;
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
693 @code{try-completion} returns whatever this function returns. The
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
694 function is called with three arguments: @var{string}, @var{predicate}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
695 and @code{nil}. (The reason for the third argument is so that the same
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
696 function can be used in @code{all-completions} and do the appropriate
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
697 thing in either case.) @xref{Programmed Completion}.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
698
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
699 If the argument @var{predicate} is non-@code{nil}, then it must be a
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
700 function of one argument, unless @var{collection} is a hash table, in
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
701 which case it should be a function of two arguments. It is used to
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
702 test each possible match, and the match is accepted only if
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
703 @var{predicate} returns non-@code{nil}. The argument given to
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
704 @var{predicate} is either a string or a cons cell (the @sc{car} of
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
705 which is a string) from the alist, or a symbol (@emph{not} a symbol
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
706 name) from the obarray. If @var{collection} is a hash table,
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
707 @var{predicate} is called with two arguments, the string key and the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
708 associated value.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
709
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
710 In addition, to be acceptable, a completion must also match all the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
711 regular expressions in @code{completion-regexp-list}. (Unless
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
712 @var{collection} is a function, in which case that function has to
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
713 handle @code{completion-regexp-list} itself.)
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
714
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
715 In the first of the following examples, the string @samp{foo} is
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
716 matched by three of the alist @sc{car}s. All of the matches begin with
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
717 the characters @samp{fooba}, so that is the result. In the second
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
718 example, there is only one possible match, and it is exact, so the value
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
719 is @code{t}.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
720
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
721 @smallexample
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
722 @group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
723 (try-completion
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
724 "foo"
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
725 '(("foobar1" 1) ("barfoo" 2) ("foobaz" 3) ("foobar2" 4)))
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
726 @result{} "fooba"
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
727 @end group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
728
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
729 @group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
730 (try-completion "foo" '(("barfoo" 2) ("foo" 3)))
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
731 @result{} t
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
732 @end group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
733 @end smallexample
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
734
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
735 In the following example, numerous symbols begin with the characters
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
736 @samp{forw}, and all of them begin with the word @samp{forward}. In
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
737 most of the symbols, this is followed with a @samp{-}, but not in all,
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
738 so no more than @samp{forward} can be completed.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
739
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
740 @smallexample
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
741 @group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
742 (try-completion "forw" obarray)
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
743 @result{} "forward"
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
744 @end group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
745 @end smallexample
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
746
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
747 Finally, in the following example, only two of the three possible
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
748 matches pass the predicate @code{test} (the string @samp{foobaz} is
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
749 too short). Both of those begin with the string @samp{foobar}.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
750
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
751 @smallexample
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
752 @group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
753 (defun test (s)
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
754 (> (length (car s)) 6))
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
755 @result{} test
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
756 @end group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
757 @group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
758 (try-completion
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
759 "foo"
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
760 '(("foobar1" 1) ("barfoo" 2) ("foobaz" 3) ("foobar2" 4))
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
761 'test)
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
762 @result{} "foobar"
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
763 @end group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
764 @end smallexample
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
765 @end defun
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
766
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
767 @defun all-completions string collection &optional predicate nospace
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
768 This function returns a list of all possible completions of
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
769 @var{string}. The arguments to this function (aside from
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
770 @var{nospace}) are the same as those of @code{try-completion}. Also,
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
771 this function uses @code{completion-regexp-list} in the same way that
106637
16b0f9d4c0c5 * frames.texi (Resources): Describe inhibit-x-resources.
Chong Yidong <cyd@stupidchicken.com>
parents: 105825
diff changeset
772 @code{try-completion} does.
16b0f9d4c0c5 * frames.texi (Resources): Describe inhibit-x-resources.
Chong Yidong <cyd@stupidchicken.com>
parents: 105825
diff changeset
773
16b0f9d4c0c5 * frames.texi (Resources): Describe inhibit-x-resources.
Chong Yidong <cyd@stupidchicken.com>
parents: 105825
diff changeset
774 The optional argument @var{nospace} is obsolete. If it is
16b0f9d4c0c5 * frames.texi (Resources): Describe inhibit-x-resources.
Chong Yidong <cyd@stupidchicken.com>
parents: 105825
diff changeset
775 non-@code{nil}, completions that start with a space are ignored unless
16b0f9d4c0c5 * frames.texi (Resources): Describe inhibit-x-resources.
Chong Yidong <cyd@stupidchicken.com>
parents: 105825
diff changeset
776 @var{string} starts with a space.
84087
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
777
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
778 If @var{collection} is a function, it is called with three arguments:
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
779 @var{string}, @var{predicate} and @code{t}; then @code{all-completions}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
780 returns whatever the function returns. @xref{Programmed Completion}.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
781
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
782 Here is an example, using the function @code{test} shown in the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
783 example for @code{try-completion}:
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
784
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
785 @smallexample
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
786 @group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
787 (defun test (s)
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
788 (> (length (car s)) 6))
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
789 @result{} test
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
790 @end group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
791
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
792 @group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
793 (all-completions
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
794 "foo"
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
795 '(("foobar1" 1) ("barfoo" 2) ("foobaz" 3) ("foobar2" 4))
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
796 'test)
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
797 @result{} ("foobar1" "foobar2")
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
798 @end group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
799 @end smallexample
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
800 @end defun
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
801
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
802 @defun test-completion string collection &optional predicate
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
803 @anchor{Definition of test-completion}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
804 This function returns non-@code{nil} if @var{string} is a valid
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
805 completion possibility specified by @var{collection} and
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
806 @var{predicate}. The arguments are the same as in
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
807 @code{try-completion}. For instance, if @var{collection} is a list of
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
808 strings, this is true if @var{string} appears in the list and
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
809 @var{predicate} is satisfied.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
810
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
811 This function uses @code{completion-regexp-list} in the same
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
812 way that @code{try-completion} does.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
813
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
814 If @var{predicate} is non-@code{nil} and if @var{collection} contains
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
815 several strings that are equal to each other, as determined by
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
816 @code{compare-strings} according to @code{completion-ignore-case},
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
817 then @var{predicate} should accept either all or none of them.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
818 Otherwise, the return value of @code{test-completion} is essentially
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
819 unpredictable.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
820
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
821 If @var{collection} is a function, it is called with three arguments,
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
822 the values @var{string}, @var{predicate} and @code{lambda}; whatever
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
823 it returns, @code{test-completion} returns in turn.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
824 @end defun
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
825
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
826 @defvar completion-ignore-case
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
827 If the value of this variable is non-@code{nil}, Emacs does not
102616
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
828 consider case significant in completion. Note, however, that this
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
829 variable is overridden by @code{read-file-name-completion-ignore-case}
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
830 within @code{read-file-name} (@pxref{Reading File Names}), and by
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
831 @code{read-buffer-completion-ignore-case} within @code{read-buffer}
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
832 (@pxref{High-Level Completion}).
84087
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
833 @end defvar
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
834
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
835 @defvar completion-regexp-list
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
836 This is a list of regular expressions. The completion functions only
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
837 consider a completion acceptable if it matches all regular expressions
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
838 in this list, with @code{case-fold-search} (@pxref{Searching and Case})
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
839 bound to the value of @code{completion-ignore-case}.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
840 @end defvar
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
841
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
842 @defmac lazy-completion-table var fun
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
843 This macro provides a way to initialize the variable @var{var} as a
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
844 collection for completion in a lazy way, not computing its actual
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
845 contents until they are first needed. You use this macro to produce a
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
846 value that you store in @var{var}. The actual computation of the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
847 proper value is done the first time you do completion using @var{var}.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
848 It is done by calling @var{fun} with no arguments. The
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
849 value @var{fun} returns becomes the permanent value of @var{var}.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
850
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
851 Here is an example of use:
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
852
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
853 @smallexample
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
854 (defvar foo (lazy-completion-table foo make-my-alist))
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
855 @end smallexample
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
856 @end defmac
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
857
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
858 @node Minibuffer Completion
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
859 @subsection Completion and the Minibuffer
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
860 @cindex minibuffer completion
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
861 @cindex reading from minibuffer with completion
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
862
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
863 This section describes the basic interface for reading from the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
864 minibuffer with completion.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
865
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
866 @defun completing-read prompt collection &optional predicate require-match initial hist default inherit-input-method
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
867 This function reads a string in the minibuffer, assisting the user by
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
868 providing completion. It activates the minibuffer with prompt
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
869 @var{prompt}, which must be a string.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
870
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
871 The actual completion is done by passing @var{collection} and
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
872 @var{predicate} to the function @code{try-completion}. This happens
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
873 in certain commands bound in the local keymaps used for completion.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
874 Some of these commands also call @code{test-completion}. Thus, if
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
875 @var{predicate} is non-@code{nil}, it should be compatible with
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
876 @var{collection} and @code{completion-ignore-case}. @xref{Definition
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
877 of test-completion}.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
878
102616
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
879 The value of the optional argument @var{require-match} determines how
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
880 the user may exit the minibuffer:
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
881
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
882 @itemize @bullet
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
883 @item
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
884 If @code{nil}, the usual minibuffer exit commands work regardless of
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
885 the input in the minibuffer.
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
886
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
887 @item
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
888 If @code{t}, the usual minibuffer exit commands won't exit unless the
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
889 input completes to an element of @var{collection}.
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
890
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
891 @item
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
892 If @code{confirm}, the user can exit with any input, but is asked for
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
893 confirmation if the input is not an element of @var{collection}.
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
894
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
895 @item
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
896 If @code{confirm-after-completion}, the user can exit with any input,
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
897 but is asked for confirmation if the preceding command was a
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
898 completion command (i.e., one of the commands in
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
899 @code{minibuffer-confirm-exit-commands}) and the resulting input is
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
900 not an element of @var{collection}. @xref{Completion Commands}.
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
901
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
902 @item
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
903 Any other value of @var{require-match} behaves like @code{t}, except
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
904 that the exit commands won't exit if it performs completion.
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
905 @end itemize
84087
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
906
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
907 However, empty input is always permitted, regardless of the value of
85662
2eb0abeec9da Minor clarifications in previous change.
Richard M. Stallman <rms@gnu.org>
parents: 85522
diff changeset
908 @var{require-match}; in that case, @code{completing-read} returns the
2eb0abeec9da Minor clarifications in previous change.
Richard M. Stallman <rms@gnu.org>
parents: 85522
diff changeset
909 first element of @var{default}, if it is a list; @code{""}, if
85718
4f560a91b164 Fix typos.
Juri Linkov <juri@jurta.org>
parents: 85662
diff changeset
910 @var{default} is @code{nil}; or @var{default}. The string or strings
4f560a91b164 Fix typos.
Juri Linkov <juri@jurta.org>
parents: 85662
diff changeset
911 in @var{default} are also available to the user through the history
85662
2eb0abeec9da Minor clarifications in previous change.
Richard M. Stallman <rms@gnu.org>
parents: 85522
diff changeset
912 commands.
84087
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
913
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
914 The function @code{completing-read} uses
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
915 @code{minibuffer-local-completion-map} as the keymap if
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
916 @var{require-match} is @code{nil}, and uses
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
917 @code{minibuffer-local-must-match-map} if @var{require-match} is
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
918 non-@code{nil}. @xref{Completion Commands}.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
919
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
920 The argument @var{hist} specifies which history list variable to use for
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
921 saving the input and for minibuffer history commands. It defaults to
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
922 @code{minibuffer-history}. @xref{Minibuffer History}.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
923
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
924 The argument @var{initial} is mostly deprecated; we recommend using a
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
925 non-@code{nil} value only in conjunction with specifying a cons cell
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
926 for @var{hist}. @xref{Initial Input}. For default input, use
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
927 @var{default} instead.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
928
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
929 If the argument @var{inherit-input-method} is non-@code{nil}, then the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
930 minibuffer inherits the current input method (@pxref{Input
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
931 Methods}) and the setting of @code{enable-multibyte-characters}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
932 (@pxref{Text Representations}) from whichever buffer was current before
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
933 entering the minibuffer.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
934
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
935 If the built-in variable @code{completion-ignore-case} is
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
936 non-@code{nil}, completion ignores case when comparing the input
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
937 against the possible matches. @xref{Basic Completion}. In this mode
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
938 of operation, @var{predicate} must also ignore case, or you will get
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
939 surprising results.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
940
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
941 Here's an example of using @code{completing-read}:
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
942
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
943 @smallexample
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
944 @group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
945 (completing-read
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
946 "Complete a foo: "
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
947 '(("foobar1" 1) ("barfoo" 2) ("foobaz" 3) ("foobar2" 4))
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
948 nil t "fo")
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
949 @end group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
950
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
951 @group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
952 ;; @r{After evaluation of the preceding expression,}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
953 ;; @r{the following appears in the minibuffer:}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
954
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
955 ---------- Buffer: Minibuffer ----------
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
956 Complete a foo: fo@point{}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
957 ---------- Buffer: Minibuffer ----------
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
958 @end group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
959 @end smallexample
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
960
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
961 @noindent
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
962 If the user then types @kbd{@key{DEL} @key{DEL} b @key{RET}},
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
963 @code{completing-read} returns @code{barfoo}.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
964
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
965 The @code{completing-read} function binds variables to pass
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
966 information to the commands that actually do completion.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
967 They are described in the following section.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
968 @end defun
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
969
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
970 @node Completion Commands
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
971 @subsection Minibuffer Commands that Do Completion
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
972
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
973 This section describes the keymaps, commands and user options used
102616
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
974 in the minibuffer to do completion.
84087
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
975
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
976 @defvar minibuffer-completion-table
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
977 The value of this variable is the collection used for completion in
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
978 the minibuffer. This is the global variable that contains what
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
979 @code{completing-read} passes to @code{try-completion}. It is used by
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
980 minibuffer completion commands such as @code{minibuffer-complete-word}.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
981 @end defvar
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
982
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
983 @defvar minibuffer-completion-predicate
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
984 This variable's value is the predicate that @code{completing-read}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
985 passes to @code{try-completion}. The variable is also used by the other
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
986 minibuffer completion functions.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
987 @end defvar
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
988
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
989 @defvar minibuffer-completion-confirm
102616
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
990 This variable determines whether Emacs asks for confirmation before
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
991 exiting the minibuffer; @code{completing-read} binds this variable,
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
992 and the function @code{minibuffer-complete-and-exit} checks the value
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
993 before exiting. If the value is @code{nil}, confirmation is not
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
994 required. If the value is @code{confirm}, the user may exit with an
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
995 input that is not a valid completion alternative, but Emacs asks for
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
996 confirmation. If the value is @code{confirm-after-completion}, the
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
997 user may exit with an input that is not a valid completion
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
998 alternative, but Emacs asks for confirmation if the user submitted the
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
999 input right after any of the completion commands in
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
1000 @code{minibuffer-confirm-exit-commands}.
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
1001 @end defvar
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
1002
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
1003 @defvar minibuffer-confirm-exit-commands
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
1004 This variable holds a list of commands that cause Emacs to ask for
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
1005 confirmation before exiting the minibuffer, if the @var{require-match}
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
1006 argument to @code{completing-read} is @code{confirm-after-completion}.
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
1007 The confirmation is requested if the user attempts to exit the
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
1008 minibuffer immediately after calling any command in this list.
84087
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1009 @end defvar
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1010
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1011 @deffn Command minibuffer-complete-word
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1012 This function completes the minibuffer contents by at most a single
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1013 word. Even if the minibuffer contents have only one completion,
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1014 @code{minibuffer-complete-word} does not add any characters beyond the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1015 first character that is not a word constituent. @xref{Syntax Tables}.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1016 @end deffn
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1017
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1018 @deffn Command minibuffer-complete
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1019 This function completes the minibuffer contents as far as possible.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1020 @end deffn
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1021
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1022 @deffn Command minibuffer-complete-and-exit
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1023 This function completes the minibuffer contents, and exits if
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1024 confirmation is not required, i.e., if
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1025 @code{minibuffer-completion-confirm} is @code{nil}. If confirmation
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1026 @emph{is} required, it is given by repeating this command
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1027 immediately---the command is programmed to work without confirmation
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1028 when run twice in succession.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1029 @end deffn
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1030
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1031 @deffn Command minibuffer-completion-help
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1032 This function creates a list of the possible completions of the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1033 current minibuffer contents. It works by calling @code{all-completions}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1034 using the value of the variable @code{minibuffer-completion-table} as
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1035 the @var{collection} argument, and the value of
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1036 @code{minibuffer-completion-predicate} as the @var{predicate} argument.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1037 The list of completions is displayed as text in a buffer named
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1038 @samp{*Completions*}.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1039 @end deffn
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1040
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1041 @defun display-completion-list completions &optional common-substring
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1042 This function displays @var{completions} to the stream in
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1043 @code{standard-output}, usually a buffer. (@xref{Read and Print}, for more
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1044 information about streams.) The argument @var{completions} is normally
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1045 a list of completions just returned by @code{all-completions}, but it
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1046 does not have to be. Each element may be a symbol or a string, either
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1047 of which is simply printed. It can also be a list of two strings,
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1048 which is printed as if the strings were concatenated. The first of
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1049 the two strings is the actual completion, the second string serves as
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1050 annotation.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1051
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1052 The argument @var{common-substring} is the prefix that is common to
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1053 all the completions. With normal Emacs completion, it is usually the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1054 same as the string that was completed. @code{display-completion-list}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1055 uses this to highlight text in the completion list for better visual
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1056 feedback. This is not needed in the minibuffer; for minibuffer
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1057 completion, you can pass @code{nil}.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1058
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1059 This function is called by @code{minibuffer-completion-help}. The
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1060 most common way to use it is together with
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1061 @code{with-output-to-temp-buffer}, like this:
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1062
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1063 @example
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1064 (with-output-to-temp-buffer "*Completions*"
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1065 (display-completion-list
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1066 (all-completions (buffer-string) my-alist)
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1067 (buffer-string)))
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1068 @end example
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1069 @end defun
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1070
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1071 @defopt completion-auto-help
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1072 If this variable is non-@code{nil}, the completion commands
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1073 automatically display a list of possible completions whenever nothing
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1074 can be completed because the next character is not uniquely determined.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1075 @end defopt
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1076
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1077 @defvar minibuffer-local-completion-map
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1078 @code{completing-read} uses this value as the local keymap when an
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1079 exact match of one of the completions is not required. By default, this
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1080 keymap makes the following bindings:
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1081
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1082 @table @asis
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1083 @item @kbd{?}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1084 @code{minibuffer-completion-help}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1085
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1086 @item @key{SPC}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1087 @code{minibuffer-complete-word}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1088
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1089 @item @key{TAB}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1090 @code{minibuffer-complete}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1091 @end table
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1092
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1093 @noindent
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1094 with other characters bound as in @code{minibuffer-local-map}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1095 (@pxref{Definition of minibuffer-local-map}).
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1096 @end defvar
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1097
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1098 @defvar minibuffer-local-must-match-map
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1099 @code{completing-read} uses this value as the local keymap when an
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1100 exact match of one of the completions is required. Therefore, no keys
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1101 are bound to @code{exit-minibuffer}, the command that exits the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1102 minibuffer unconditionally. By default, this keymap makes the following
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1103 bindings:
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1104
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1105 @table @asis
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1106 @item @kbd{?}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1107 @code{minibuffer-completion-help}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1108
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1109 @item @key{SPC}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1110 @code{minibuffer-complete-word}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1111
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1112 @item @key{TAB}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1113 @code{minibuffer-complete}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1114
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1115 @item @kbd{C-j}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1116 @code{minibuffer-complete-and-exit}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1117
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1118 @item @key{RET}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1119 @code{minibuffer-complete-and-exit}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1120 @end table
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1121
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1122 @noindent
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1123 with other characters bound as in @code{minibuffer-local-map}.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1124 @end defvar
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1125
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1126 @defvar minibuffer-local-filename-completion-map
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1127 This is like @code{minibuffer-local-completion-map}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1128 except that it does not bind @key{SPC}. This keymap is used by the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1129 function @code{read-file-name}.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1130 @end defvar
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1131
98815
9cbd69c7bb9d (Text from Minibuffer): Document `read-regexp'.
Eli Zaretskii <eliz@gnu.org>
parents: 94530
diff changeset
1132 @defvar minibuffer-local-filename-must-match-map
84087
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1133 This is like @code{minibuffer-local-must-match-map}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1134 except that it does not bind @key{SPC}. This keymap is used by the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1135 function @code{read-file-name}.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1136 @end defvar
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1137
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1138 @node High-Level Completion
98897
3bc1332e6140 (Reading File Names): Document `read-shell-command' and
Eli Zaretskii <eliz@gnu.org>
parents: 98842
diff changeset
1139 @subsection High-Level Completion Functions
84087
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1140
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1141 This section describes the higher-level convenient functions for
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1142 reading certain sorts of names with completion.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1143
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1144 In most cases, you should not call these functions in the middle of a
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1145 Lisp function. When possible, do all minibuffer input as part of
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1146 reading the arguments for a command, in the @code{interactive}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1147 specification. @xref{Defining Commands}.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1148
102616
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
1149 @defun read-buffer prompt &optional default require-match
84087
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1150 This function reads the name of a buffer and returns it as a string.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1151 The argument @var{default} is the default name to use, the value to
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1152 return if the user exits with an empty minibuffer. If non-@code{nil},
85522
25264f468203 (Text from Minibuffer, Minibuffer Completion, High-Level Completion):
Juri Linkov <juri@jurta.org>
parents: 84116
diff changeset
1153 it should be a string, a list of strings, or a buffer. If it is
25264f468203 (Text from Minibuffer, Minibuffer Completion, High-Level Completion):
Juri Linkov <juri@jurta.org>
parents: 84116
diff changeset
1154 a list, the default value is the first element of this list. It is
25264f468203 (Text from Minibuffer, Minibuffer Completion, High-Level Completion):
Juri Linkov <juri@jurta.org>
parents: 84116
diff changeset
1155 mentioned in the prompt, but is not inserted in the minibuffer as
25264f468203 (Text from Minibuffer, Minibuffer Completion, High-Level Completion):
Juri Linkov <juri@jurta.org>
parents: 84116
diff changeset
1156 initial input.
84087
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1157
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1158 The argument @var{prompt} should be a string ending with a colon and a
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1159 space. If @var{default} is non-@code{nil}, the function inserts it in
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1160 @var{prompt} before the colon to follow the convention for reading from
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1161 the minibuffer with a default value (@pxref{Programming Tips}).
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1162
102616
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
1163 The optional argument @var{require-match} has the same meaning as in
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
1164 @code{completing-read}. @xref{Minibuffer Completion}.
84087
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1165
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1166 In the following example, the user enters @samp{minibuffer.t}, and
102616
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
1167 then types @key{RET}. The argument @var{require-match} is @code{t},
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
1168 and the only buffer name starting with the given input is
84087
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1169 @samp{minibuffer.texi}, so that name is the value.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1170
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1171 @example
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1172 (read-buffer "Buffer name: " "foo" t)
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1173 @group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1174 ;; @r{After evaluation of the preceding expression,}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1175 ;; @r{the following prompt appears,}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1176 ;; @r{with an empty minibuffer:}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1177 @end group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1178
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1179 @group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1180 ---------- Buffer: Minibuffer ----------
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1181 Buffer name (default foo): @point{}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1182 ---------- Buffer: Minibuffer ----------
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1183 @end group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1184
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1185 @group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1186 ;; @r{The user types @kbd{minibuffer.t @key{RET}}.}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1187 @result{} "minibuffer.texi"
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1188 @end group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1189 @end example
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1190 @end defun
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1191
103273
c32ec20d0ab5 * abbrevs.texi (Abbrev Mode): abbrev-mode is an option.
Martin Rudalics <rudalics@gmx.at>
parents: 103264
diff changeset
1192 @defopt read-buffer-function
84087
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1193 This variable specifies how to read buffer names. For example, if you
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1194 set this variable to @code{iswitchb-read-buffer}, all Emacs commands
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1195 that call @code{read-buffer} to read a buffer name will actually use the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1196 @code{iswitchb} package to read it.
103273
c32ec20d0ab5 * abbrevs.texi (Abbrev Mode): abbrev-mode is an option.
Martin Rudalics <rudalics@gmx.at>
parents: 103264
diff changeset
1197 @end defopt
84087
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1198
103273
c32ec20d0ab5 * abbrevs.texi (Abbrev Mode): abbrev-mode is an option.
Martin Rudalics <rudalics@gmx.at>
parents: 103264
diff changeset
1199 @defopt read-buffer-completion-ignore-case
102616
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
1200 If this variable is non-@code{nil}, @code{read-buffer} ignores case
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
1201 when performing completion.
103273
c32ec20d0ab5 * abbrevs.texi (Abbrev Mode): abbrev-mode is an option.
Martin Rudalics <rudalics@gmx.at>
parents: 103264
diff changeset
1202 @end defopt
102616
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
1203
84087
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1204 @defun read-command prompt &optional default
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1205 This function reads the name of a command and returns it as a Lisp
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1206 symbol. The argument @var{prompt} is used as in
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1207 @code{read-from-minibuffer}. Recall that a command is anything for
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1208 which @code{commandp} returns @code{t}, and a command name is a symbol
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1209 for which @code{commandp} returns @code{t}. @xref{Interactive Call}.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1210
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1211 The argument @var{default} specifies what to return if the user enters
85522
25264f468203 (Text from Minibuffer, Minibuffer Completion, High-Level Completion):
Juri Linkov <juri@jurta.org>
parents: 84116
diff changeset
1212 null input. It can be a symbol, a string or a list of strings. If it
25264f468203 (Text from Minibuffer, Minibuffer Completion, High-Level Completion):
Juri Linkov <juri@jurta.org>
parents: 84116
diff changeset
1213 is a string, @code{read-command} interns it before returning it.
25264f468203 (Text from Minibuffer, Minibuffer Completion, High-Level Completion):
Juri Linkov <juri@jurta.org>
parents: 84116
diff changeset
1214 If it is a list, @code{read-command} returns the first element of this list.
25264f468203 (Text from Minibuffer, Minibuffer Completion, High-Level Completion):
Juri Linkov <juri@jurta.org>
parents: 84116
diff changeset
1215 If @var{default} is @code{nil}, that means no default has been
25264f468203 (Text from Minibuffer, Minibuffer Completion, High-Level Completion):
Juri Linkov <juri@jurta.org>
parents: 84116
diff changeset
1216 specified; then if the user enters null input, the return value is
25264f468203 (Text from Minibuffer, Minibuffer Completion, High-Level Completion):
Juri Linkov <juri@jurta.org>
parents: 84116
diff changeset
1217 @code{(intern "")}, that is, a symbol whose name is an empty string.
84087
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1218
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1219 @example
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1220 (read-command "Command name? ")
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1221
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1222 @group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1223 ;; @r{After evaluation of the preceding expression,}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1224 ;; @r{the following prompt appears with an empty minibuffer:}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1225 @end group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1226
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1227 @group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1228 ---------- Buffer: Minibuffer ----------
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1229 Command name?
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1230 ---------- Buffer: Minibuffer ----------
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1231 @end group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1232 @end example
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1233
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1234 @noindent
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1235 If the user types @kbd{forward-c @key{RET}}, then this function returns
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1236 @code{forward-char}.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1237
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1238 The @code{read-command} function is a simplified interface to
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1239 @code{completing-read}. It uses the variable @code{obarray} so as to
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1240 complete in the set of extant Lisp symbols, and it uses the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1241 @code{commandp} predicate so as to accept only command names:
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1242
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1243 @cindex @code{commandp} example
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1244 @example
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1245 @group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1246 (read-command @var{prompt})
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1247 @equiv{}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1248 (intern (completing-read @var{prompt} obarray
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1249 'commandp t nil))
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1250 @end group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1251 @end example
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1252 @end defun
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1253
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1254 @defun read-variable prompt &optional default
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1255 @anchor{Definition of read-variable}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1256 This function reads the name of a user variable and returns it as a
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1257 symbol.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1258
85662
2eb0abeec9da Minor clarifications in previous change.
Richard M. Stallman <rms@gnu.org>
parents: 85522
diff changeset
1259 The argument @var{default} specifies the default value to return if
2eb0abeec9da Minor clarifications in previous change.
Richard M. Stallman <rms@gnu.org>
parents: 85522
diff changeset
1260 the user enters null input. It can be a symbol, a string, or a list
2eb0abeec9da Minor clarifications in previous change.
Richard M. Stallman <rms@gnu.org>
parents: 85522
diff changeset
1261 of strings. If it is a string, @code{read-variable} interns it to
85718
4f560a91b164 Fix typos.
Juri Linkov <juri@jurta.org>
parents: 85662
diff changeset
1262 make the default value. If it is a list, @code{read-variable} interns
85662
2eb0abeec9da Minor clarifications in previous change.
Richard M. Stallman <rms@gnu.org>
parents: 85522
diff changeset
1263 the first element. If @var{default} is @code{nil}, that means no
2eb0abeec9da Minor clarifications in previous change.
Richard M. Stallman <rms@gnu.org>
parents: 85522
diff changeset
1264 default has been specified; then if the user enters null input, the
2eb0abeec9da Minor clarifications in previous change.
Richard M. Stallman <rms@gnu.org>
parents: 85522
diff changeset
1265 return value is @code{(intern "")}.
84087
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1266
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1267 @example
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1268 @group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1269 (read-variable "Variable name? ")
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1270
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1271 ;; @r{After evaluation of the preceding expression,}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1272 ;; @r{the following prompt appears,}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1273 ;; @r{with an empty minibuffer:}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1274 @end group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1275
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1276 @group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1277 ---------- Buffer: Minibuffer ----------
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1278 Variable name? @point{}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1279 ---------- Buffer: Minibuffer ----------
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1280 @end group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1281 @end example
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1282
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1283 @noindent
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1284 If the user then types @kbd{fill-p @key{RET}}, @code{read-variable}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1285 returns @code{fill-prefix}.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1286
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1287 In general, @code{read-variable} is similar to @code{read-command},
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1288 but uses the predicate @code{user-variable-p} instead of
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1289 @code{commandp}:
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1290
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1291 @cindex @code{user-variable-p} example
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1292 @example
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1293 @group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1294 (read-variable @var{prompt})
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1295 @equiv{}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1296 (intern
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1297 (completing-read @var{prompt} obarray
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1298 'user-variable-p t nil))
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1299 @end group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1300 @end example
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1301 @end defun
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1302
98968
155f65cc590b (High-Level Completion): Document `read-color'.
Eli Zaretskii <eliz@gnu.org>
parents: 98932
diff changeset
1303 @deffn Command read-color &optional prompt convert allow-empty display
155f65cc590b (High-Level Completion): Document `read-color'.
Eli Zaretskii <eliz@gnu.org>
parents: 98932
diff changeset
1304 This function reads a string that is a color specification, either the
155f65cc590b (High-Level Completion): Document `read-color'.
Eli Zaretskii <eliz@gnu.org>
parents: 98932
diff changeset
1305 color's name or an RGB hex value such as @code{#RRRGGGBBB}. It
155f65cc590b (High-Level Completion): Document `read-color'.
Eli Zaretskii <eliz@gnu.org>
parents: 98932
diff changeset
1306 prompts with @var{prompt} (default: @code{"Color (name or #R+G+B+):"})
155f65cc590b (High-Level Completion): Document `read-color'.
Eli Zaretskii <eliz@gnu.org>
parents: 98932
diff changeset
1307 and provides completion for color names, but not for hex RGB values.
155f65cc590b (High-Level Completion): Document `read-color'.
Eli Zaretskii <eliz@gnu.org>
parents: 98932
diff changeset
1308 In addition to names of standard colors, completion candidates include
155f65cc590b (High-Level Completion): Document `read-color'.
Eli Zaretskii <eliz@gnu.org>
parents: 98932
diff changeset
1309 the foreground and background colors at point.
155f65cc590b (High-Level Completion): Document `read-color'.
Eli Zaretskii <eliz@gnu.org>
parents: 98932
diff changeset
1310
155f65cc590b (High-Level Completion): Document `read-color'.
Eli Zaretskii <eliz@gnu.org>
parents: 98932
diff changeset
1311 Valid RGB values are described in @ref{Color Names}.
155f65cc590b (High-Level Completion): Document `read-color'.
Eli Zaretskii <eliz@gnu.org>
parents: 98932
diff changeset
1312
155f65cc590b (High-Level Completion): Document `read-color'.
Eli Zaretskii <eliz@gnu.org>
parents: 98932
diff changeset
1313 The function's return value is the color name typed by the user in the
155f65cc590b (High-Level Completion): Document `read-color'.
Eli Zaretskii <eliz@gnu.org>
parents: 98932
diff changeset
1314 minibuffer. However, when called interactively or if the optional
155f65cc590b (High-Level Completion): Document `read-color'.
Eli Zaretskii <eliz@gnu.org>
parents: 98932
diff changeset
1315 argument @var{convert} is non-@code{nil}, it converts the name into
155f65cc590b (High-Level Completion): Document `read-color'.
Eli Zaretskii <eliz@gnu.org>
parents: 98932
diff changeset
1316 the color's RGB value and returns that value as a string. If an
155f65cc590b (High-Level Completion): Document `read-color'.
Eli Zaretskii <eliz@gnu.org>
parents: 98932
diff changeset
1317 invalid color name was specified, this function signals an error,
155f65cc590b (High-Level Completion): Document `read-color'.
Eli Zaretskii <eliz@gnu.org>
parents: 98932
diff changeset
1318 except that empty color names are allowed when @code{allow-empty} is
155f65cc590b (High-Level Completion): Document `read-color'.
Eli Zaretskii <eliz@gnu.org>
parents: 98932
diff changeset
1319 non-@code{nil} and the user enters null input.
155f65cc590b (High-Level Completion): Document `read-color'.
Eli Zaretskii <eliz@gnu.org>
parents: 98932
diff changeset
1320
103335
363ad3cbabd0 * minibuf.texi (Reading File Names): Fix introductory text.
Chong Yidong <cyd@stupidchicken.com>
parents: 103273
diff changeset
1321 Interactively, or when @var{display} is non-@code{nil}, the return
98968
155f65cc590b (High-Level Completion): Document `read-color'.
Eli Zaretskii <eliz@gnu.org>
parents: 98932
diff changeset
1322 value is also displayed in the echo area.
155f65cc590b (High-Level Completion): Document `read-color'.
Eli Zaretskii <eliz@gnu.org>
parents: 98932
diff changeset
1323 @end deffn
155f65cc590b (High-Level Completion): Document `read-color'.
Eli Zaretskii <eliz@gnu.org>
parents: 98932
diff changeset
1324
84087
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1325 See also the functions @code{read-coding-system} and
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1326 @code{read-non-nil-coding-system}, in @ref{User-Chosen Coding Systems},
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1327 and @code{read-input-method-name}, in @ref{Input Methods}.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1328
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1329 @node Reading File Names
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1330 @subsection Reading File Names
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1331 @cindex read file names
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1332 @cindex prompt for file name
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1333
103335
363ad3cbabd0 * minibuf.texi (Reading File Names): Fix introductory text.
Chong Yidong <cyd@stupidchicken.com>
parents: 103273
diff changeset
1334 The high-level completion functions @code{read-file-name},
363ad3cbabd0 * minibuf.texi (Reading File Names): Fix introductory text.
Chong Yidong <cyd@stupidchicken.com>
parents: 103273
diff changeset
1335 @code{read-directory-name}, and @code{read-shell-command} are designed
363ad3cbabd0 * minibuf.texi (Reading File Names): Fix introductory text.
Chong Yidong <cyd@stupidchicken.com>
parents: 103273
diff changeset
1336 to read file names, directory names, and shell commands respectively.
363ad3cbabd0 * minibuf.texi (Reading File Names): Fix introductory text.
Chong Yidong <cyd@stupidchicken.com>
parents: 103273
diff changeset
1337 They provide special features, including automatic insertion of the
363ad3cbabd0 * minibuf.texi (Reading File Names): Fix introductory text.
Chong Yidong <cyd@stupidchicken.com>
parents: 103273
diff changeset
1338 default directory.
84087
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1339
102616
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
1340 @defun read-file-name prompt &optional directory default require-match initial predicate
105825
da9cc794b4ec * minibuf.texi (Reading File Names): Note that read-file-name may
Chong Yidong <cyd@stupidchicken.com>
parents: 103831
diff changeset
1341 This function reads a file name, prompting with @var{prompt} and
da9cc794b4ec * minibuf.texi (Reading File Names): Note that read-file-name may
Chong Yidong <cyd@stupidchicken.com>
parents: 103831
diff changeset
1342 providing completion.
da9cc794b4ec * minibuf.texi (Reading File Names): Note that read-file-name may
Chong Yidong <cyd@stupidchicken.com>
parents: 103831
diff changeset
1343
da9cc794b4ec * minibuf.texi (Reading File Names): Note that read-file-name may
Chong Yidong <cyd@stupidchicken.com>
parents: 103831
diff changeset
1344 As an exception, this function reads a file name using a graphical
da9cc794b4ec * minibuf.texi (Reading File Names): Note that read-file-name may
Chong Yidong <cyd@stupidchicken.com>
parents: 103831
diff changeset
1345 file dialog instead of the minibuffer, if (i) it is invoked via a
da9cc794b4ec * minibuf.texi (Reading File Names): Note that read-file-name may
Chong Yidong <cyd@stupidchicken.com>
parents: 103831
diff changeset
1346 mouse command, and (ii) the selected frame is on a graphical display
da9cc794b4ec * minibuf.texi (Reading File Names): Note that read-file-name may
Chong Yidong <cyd@stupidchicken.com>
parents: 103831
diff changeset
1347 supporting such dialogs, and (iii) the variable @code{use-dialog-box}
da9cc794b4ec * minibuf.texi (Reading File Names): Note that read-file-name may
Chong Yidong <cyd@stupidchicken.com>
parents: 103831
diff changeset
1348 is non-@code{nil} (@pxref{Dialog Boxes,, Dialog Boxes, emacs, The GNU
da9cc794b4ec * minibuf.texi (Reading File Names): Note that read-file-name may
Chong Yidong <cyd@stupidchicken.com>
parents: 103831
diff changeset
1349 Emacs Manual}), and (iv) the @var{directory} argument, described
da9cc794b4ec * minibuf.texi (Reading File Names): Note that read-file-name may
Chong Yidong <cyd@stupidchicken.com>
parents: 103831
diff changeset
1350 below, does not specify a remote file (@pxref{Remote Files,, Remote
da9cc794b4ec * minibuf.texi (Reading File Names): Note that read-file-name may
Chong Yidong <cyd@stupidchicken.com>
parents: 103831
diff changeset
1351 Files, emacs, The GNU Emacs Manual}). The exact behavior when using a
da9cc794b4ec * minibuf.texi (Reading File Names): Note that read-file-name may
Chong Yidong <cyd@stupidchicken.com>
parents: 103831
diff changeset
1352 graphical file dialog is platform-dependent. Here, we simply document
da9cc794b4ec * minibuf.texi (Reading File Names): Note that read-file-name may
Chong Yidong <cyd@stupidchicken.com>
parents: 103831
diff changeset
1353 the behavior when using the minibuffer.
84087
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1354
102616
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
1355 The optional argument @var{require-match} has the same meaning as in
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
1356 @code{completing-read}. @xref{Minibuffer Completion}.
84087
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1357
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1358 @code{read-file-name} uses
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1359 @code{minibuffer-local-filename-completion-map} as the keymap if
102616
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
1360 @var{require-match} is @code{nil}, and uses
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
1361 @code{minibuffer-local-filename-must-match-map} if @var{require-match}
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
1362 is non-@code{nil}. @xref{Completion Commands}.
84087
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1363
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1364 The argument @var{directory} specifies the directory to use for
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1365 completion of relative file names. It should be an absolute directory
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1366 name. If @code{insert-default-directory} is non-@code{nil},
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1367 @var{directory} is also inserted in the minibuffer as initial input.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1368 It defaults to the current buffer's value of @code{default-directory}.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1369
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1370 If you specify @var{initial}, that is an initial file name to insert
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1371 in the buffer (after @var{directory}, if that is inserted). In this
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1372 case, point goes at the beginning of @var{initial}. The default for
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1373 @var{initial} is @code{nil}---don't insert any file name. To see what
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1374 @var{initial} does, try the command @kbd{C-x C-v}. @strong{Please
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1375 note:} we recommend using @var{default} rather than @var{initial} in
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1376 most cases.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1377
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1378 If @var{default} is non-@code{nil}, then the function returns
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1379 @var{default} if the user exits the minibuffer with the same non-empty
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1380 contents that @code{read-file-name} inserted initially. The initial
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1381 minibuffer contents are always non-empty if
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1382 @code{insert-default-directory} is non-@code{nil}, as it is by
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1383 default. @var{default} is not checked for validity, regardless of the
102616
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
1384 value of @var{require-match}. However, if @var{require-match} is
84087
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1385 non-@code{nil}, the initial minibuffer contents should be a valid file
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1386 (or directory) name. Otherwise @code{read-file-name} attempts
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1387 completion if the user exits without any editing, and does not return
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1388 @var{default}. @var{default} is also available through the history
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1389 commands.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1390
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1391 If @var{default} is @code{nil}, @code{read-file-name} tries to find a
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1392 substitute default to use in its place, which it treats in exactly the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1393 same way as if it had been specified explicitly. If @var{default} is
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1394 @code{nil}, but @var{initial} is non-@code{nil}, then the default is
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1395 the absolute file name obtained from @var{directory} and
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1396 @var{initial}. If both @var{default} and @var{initial} are @code{nil}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1397 and the buffer is visiting a file, @code{read-file-name} uses the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1398 absolute file name of that file as default. If the buffer is not
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1399 visiting a file, then there is no default. In that case, if the user
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1400 types @key{RET} without any editing, @code{read-file-name} simply
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1401 returns the pre-inserted contents of the minibuffer.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1402
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1403 If the user types @key{RET} in an empty minibuffer, this function
102616
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
1404 returns an empty string, regardless of the value of
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
1405 @var{require-match}. This is, for instance, how the user can make the
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
1406 current buffer visit no file using @code{M-x set-visited-file-name}.
84087
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1407
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1408 If @var{predicate} is non-@code{nil}, it specifies a function of one
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1409 argument that decides which file names are acceptable completion
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1410 possibilities. A file name is an acceptable value if @var{predicate}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1411 returns non-@code{nil} for it.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1412
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1413 @code{read-file-name} does not automatically expand file names. You
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1414 must call @code{expand-file-name} yourself if an absolute file name is
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1415 required.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1416
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1417 Here is an example:
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1418
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1419 @example
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1420 @group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1421 (read-file-name "The file is ")
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1422
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1423 ;; @r{After evaluation of the preceding expression,}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1424 ;; @r{the following appears in the minibuffer:}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1425 @end group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1426
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1427 @group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1428 ---------- Buffer: Minibuffer ----------
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1429 The file is /gp/gnu/elisp/@point{}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1430 ---------- Buffer: Minibuffer ----------
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1431 @end group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1432 @end example
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1433
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1434 @noindent
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1435 Typing @kbd{manual @key{TAB}} results in the following:
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1436
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1437 @example
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1438 @group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1439 ---------- Buffer: Minibuffer ----------
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1440 The file is /gp/gnu/elisp/manual.texi@point{}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1441 ---------- Buffer: Minibuffer ----------
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1442 @end group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1443 @end example
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1444
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1445 @c Wordy to avoid overfull hbox in smallbook mode.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1446 @noindent
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1447 If the user types @key{RET}, @code{read-file-name} returns the file name
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1448 as the string @code{"/gp/gnu/elisp/manual.texi"}.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1449 @end defun
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1450
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1451 @defvar read-file-name-function
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1452 If non-@code{nil}, this should be a function that accepts the same
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1453 arguments as @code{read-file-name}. When @code{read-file-name} is
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1454 called, it calls this function with the supplied arguments instead of
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1455 doing its usual work.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1456 @end defvar
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1457
103273
c32ec20d0ab5 * abbrevs.texi (Abbrev Mode): abbrev-mode is an option.
Martin Rudalics <rudalics@gmx.at>
parents: 103264
diff changeset
1458 @defopt read-file-name-completion-ignore-case
84087
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1459 If this variable is non-@code{nil}, @code{read-file-name} ignores case
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1460 when performing completion.
103273
c32ec20d0ab5 * abbrevs.texi (Abbrev Mode): abbrev-mode is an option.
Martin Rudalics <rudalics@gmx.at>
parents: 103264
diff changeset
1461 @end defopt
84087
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1462
102616
25d094256b42 (Basic Completion): Note that read-file-name-completion-ignore-case
Chong Yidong <cyd@stupidchicken.com>
parents: 101017
diff changeset
1463 @defun read-directory-name prompt &optional directory default require-match initial
84087
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1464 This function is like @code{read-file-name} but allows only directory
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1465 names as completion possibilities.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1466
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1467 If @var{default} is @code{nil} and @var{initial} is non-@code{nil},
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1468 @code{read-directory-name} constructs a substitute default by
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1469 combining @var{directory} (or the current buffer's default directory
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1470 if @var{directory} is @code{nil}) and @var{initial}. If both
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1471 @var{default} and @var{initial} are @code{nil}, this function uses
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1472 @var{directory} as substitute default, or the current buffer's default
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1473 directory if @var{directory} is @code{nil}.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1474 @end defun
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1475
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1476 @defopt insert-default-directory
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1477 This variable is used by @code{read-file-name}, and thus, indirectly,
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1478 by most commands reading file names. (This includes all commands that
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1479 use the code letters @samp{f} or @samp{F} in their interactive form.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1480 @xref{Interactive Codes,, Code Characters for interactive}.) Its
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1481 value controls whether @code{read-file-name} starts by placing the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1482 name of the default directory in the minibuffer, plus the initial file
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1483 name if any. If the value of this variable is @code{nil}, then
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1484 @code{read-file-name} does not place any initial input in the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1485 minibuffer (unless you specify initial input with the @var{initial}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1486 argument). In that case, the default directory is still used for
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1487 completion of relative file names, but is not displayed.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1488
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1489 If this variable is @code{nil} and the initial minibuffer contents are
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1490 empty, the user may have to explicitly fetch the next history element
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1491 to access a default value. If the variable is non-@code{nil}, the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1492 initial minibuffer contents are always non-empty and the user can
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1493 always request a default value by immediately typing @key{RET} in an
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1494 unedited minibuffer. (See above.)
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1495
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1496 For example:
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1497
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1498 @example
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1499 @group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1500 ;; @r{Here the minibuffer starts out with the default directory.}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1501 (let ((insert-default-directory t))
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1502 (read-file-name "The file is "))
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1503 @end group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1504
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1505 @group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1506 ---------- Buffer: Minibuffer ----------
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1507 The file is ~lewis/manual/@point{}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1508 ---------- Buffer: Minibuffer ----------
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1509 @end group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1510
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1511 @group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1512 ;; @r{Here the minibuffer is empty and only the prompt}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1513 ;; @r{appears on its line.}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1514 (let ((insert-default-directory nil))
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1515 (read-file-name "The file is "))
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1516 @end group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1517
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1518 @group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1519 ---------- Buffer: Minibuffer ----------
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1520 The file is @point{}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1521 ---------- Buffer: Minibuffer ----------
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1522 @end group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1523 @end example
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1524 @end defopt
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1525
98897
3bc1332e6140 (Reading File Names): Document `read-shell-command' and
Eli Zaretskii <eliz@gnu.org>
parents: 98842
diff changeset
1526 @defun read-shell-command prompt &optional initial-contents hist &rest args
3bc1332e6140 (Reading File Names): Document `read-shell-command' and
Eli Zaretskii <eliz@gnu.org>
parents: 98842
diff changeset
1527 This function reads a shell command from the minibuffer, prompting
3bc1332e6140 (Reading File Names): Document `read-shell-command' and
Eli Zaretskii <eliz@gnu.org>
parents: 98842
diff changeset
1528 with @var{prompt} and providing intelligent completion. It completes
3bc1332e6140 (Reading File Names): Document `read-shell-command' and
Eli Zaretskii <eliz@gnu.org>
parents: 98842
diff changeset
1529 the first word of the command using candidates that are appropriate
98932
6e980913f210 (Reading File Names): Wording changes from RMS.
Eli Zaretskii <eliz@gnu.org>
parents: 98911
diff changeset
1530 for command names, and the rest of the command words as file names.
98897
3bc1332e6140 (Reading File Names): Document `read-shell-command' and
Eli Zaretskii <eliz@gnu.org>
parents: 98842
diff changeset
1531
98932
6e980913f210 (Reading File Names): Wording changes from RMS.
Eli Zaretskii <eliz@gnu.org>
parents: 98911
diff changeset
1532 This function uses @code{minibuffer-local-shell-command-map} as the
6e980913f210 (Reading File Names): Wording changes from RMS.
Eli Zaretskii <eliz@gnu.org>
parents: 98911
diff changeset
1533 keymap for minibuffer input. The @var{hist} argument specifies the
6e980913f210 (Reading File Names): Wording changes from RMS.
Eli Zaretskii <eliz@gnu.org>
parents: 98911
diff changeset
1534 history list to use; if is omitted or @code{nil}, it defaults to
98897
3bc1332e6140 (Reading File Names): Document `read-shell-command' and
Eli Zaretskii <eliz@gnu.org>
parents: 98842
diff changeset
1535 @code{shell-command-history} (@pxref{Minibuffer History,
98932
6e980913f210 (Reading File Names): Wording changes from RMS.
Eli Zaretskii <eliz@gnu.org>
parents: 98911
diff changeset
1536 shell-command-history}). The optional argument @var{initial-contents}
6e980913f210 (Reading File Names): Wording changes from RMS.
Eli Zaretskii <eliz@gnu.org>
parents: 98911
diff changeset
1537 specifies the initial content of the minibuffer (@pxref{Initial
6e980913f210 (Reading File Names): Wording changes from RMS.
Eli Zaretskii <eliz@gnu.org>
parents: 98911
diff changeset
1538 Input}). The rest of @var{args}, if present, are used as the
6e980913f210 (Reading File Names): Wording changes from RMS.
Eli Zaretskii <eliz@gnu.org>
parents: 98911
diff changeset
1539 @var{default} and @var{inherit-input-method} arguments in
6e980913f210 (Reading File Names): Wording changes from RMS.
Eli Zaretskii <eliz@gnu.org>
parents: 98911
diff changeset
1540 @code{read-from-minibuffer} (@pxref{Text from Minibuffer}).
98897
3bc1332e6140 (Reading File Names): Document `read-shell-command' and
Eli Zaretskii <eliz@gnu.org>
parents: 98842
diff changeset
1541 @end defun
3bc1332e6140 (Reading File Names): Document `read-shell-command' and
Eli Zaretskii <eliz@gnu.org>
parents: 98842
diff changeset
1542
3bc1332e6140 (Reading File Names): Document `read-shell-command' and
Eli Zaretskii <eliz@gnu.org>
parents: 98842
diff changeset
1543 @defvar minibuffer-local-shell-command-map
3bc1332e6140 (Reading File Names): Document `read-shell-command' and
Eli Zaretskii <eliz@gnu.org>
parents: 98842
diff changeset
1544 This keymap is used by @code{read-shell-command} for completing
3bc1332e6140 (Reading File Names): Document `read-shell-command' and
Eli Zaretskii <eliz@gnu.org>
parents: 98842
diff changeset
1545 command and file names that are part of a shell command.
3bc1332e6140 (Reading File Names): Document `read-shell-command' and
Eli Zaretskii <eliz@gnu.org>
parents: 98842
diff changeset
1546 @end defvar
3bc1332e6140 (Reading File Names): Document `read-shell-command' and
Eli Zaretskii <eliz@gnu.org>
parents: 98842
diff changeset
1547
102624
6ddfdbfcd361 (Completion Styles): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 102616
diff changeset
1548 @node Completion Styles
6ddfdbfcd361 (Completion Styles): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 102616
diff changeset
1549 @subsection Completion Styles
6ddfdbfcd361 (Completion Styles): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 102616
diff changeset
1550 @cindex completion styles
6ddfdbfcd361 (Completion Styles): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 102616
diff changeset
1551
6ddfdbfcd361 (Completion Styles): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 102616
diff changeset
1552 A @dfn{completion style} is a set of rules for generating
6ddfdbfcd361 (Completion Styles): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 102616
diff changeset
1553 completions. The user option @code{completion-styles} stores a list
6ddfdbfcd361 (Completion Styles): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 102616
diff changeset
1554 of completion styles, which are represented by symbols.
6ddfdbfcd361 (Completion Styles): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 102616
diff changeset
1555
6ddfdbfcd361 (Completion Styles): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 102616
diff changeset
1556 @defopt completion-styles
6ddfdbfcd361 (Completion Styles): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 102616
diff changeset
1557 This is a list of completion style symbols to use for performing
6ddfdbfcd361 (Completion Styles): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 102616
diff changeset
1558 completion. Each completion style in this list must be defined in
6ddfdbfcd361 (Completion Styles): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 102616
diff changeset
1559 @code{completion-styles-alist}.
6ddfdbfcd361 (Completion Styles): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 102616
diff changeset
1560 @end defopt
6ddfdbfcd361 (Completion Styles): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 102616
diff changeset
1561
6ddfdbfcd361 (Completion Styles): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 102616
diff changeset
1562 @defvar completion-styles-alist
6ddfdbfcd361 (Completion Styles): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 102616
diff changeset
1563 This variable stores a list of available completion styles. Each
6ddfdbfcd361 (Completion Styles): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 102616
diff changeset
1564 element in the list must have the form @samp{(@var{name}
6ddfdbfcd361 (Completion Styles): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 102616
diff changeset
1565 @var{try-completion} @var{all-completions})}. Here, @var{name} is the
6ddfdbfcd361 (Completion Styles): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 102616
diff changeset
1566 name of the completion style (a symbol), which may be used in
6ddfdbfcd361 (Completion Styles): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 102616
diff changeset
1567 @code{completion-styles-alist} to refer to this style.
6ddfdbfcd361 (Completion Styles): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 102616
diff changeset
1568
6ddfdbfcd361 (Completion Styles): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 102616
diff changeset
1569 @var{try-completion} is the function that does the completion, and
6ddfdbfcd361 (Completion Styles): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 102616
diff changeset
1570 @var{all-completions} is the function that lists the completions.
6ddfdbfcd361 (Completion Styles): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 102616
diff changeset
1571 These functions should accept four arguments: @var{string},
6ddfdbfcd361 (Completion Styles): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 102616
diff changeset
1572 @var{collection}, @var{predicate}, and @var{point}. The @var{string},
6ddfdbfcd361 (Completion Styles): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 102616
diff changeset
1573 @var{collection}, and @var{predicate} arguments have the same meanings
6ddfdbfcd361 (Completion Styles): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 102616
diff changeset
1574 as in @code{try-completion} (@pxref{Basic Completion}), and the
6ddfdbfcd361 (Completion Styles): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 102616
diff changeset
1575 @var{point} argument is the position of point within @var{string}.
6ddfdbfcd361 (Completion Styles): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 102616
diff changeset
1576 Each function should return a non-@code{nil} value if it performed its
6ddfdbfcd361 (Completion Styles): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 102616
diff changeset
1577 job, and @code{nil} if it did not (e.g., if there is no way to
6ddfdbfcd361 (Completion Styles): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 102616
diff changeset
1578 complete @var{string} according to the completion style).
6ddfdbfcd361 (Completion Styles): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 102616
diff changeset
1579
6ddfdbfcd361 (Completion Styles): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 102616
diff changeset
1580 When the user calls a completion command, such as
6ddfdbfcd361 (Completion Styles): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 102616
diff changeset
1581 @code{minibuffer-complete} (@pxref{Completion Commands}), Emacs looks
6ddfdbfcd361 (Completion Styles): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 102616
diff changeset
1582 for the first style listed in @code{completion-styles} and calls its
6ddfdbfcd361 (Completion Styles): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 102616
diff changeset
1583 @var{try-completion} function. If this function returns @code{nil},
6ddfdbfcd361 (Completion Styles): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 102616
diff changeset
1584 Emacs moves to the next completion style listed in
6ddfdbfcd361 (Completion Styles): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 102616
diff changeset
1585 @code{completion-styles} and calls its @var{try-completion} function,
6ddfdbfcd361 (Completion Styles): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 102616
diff changeset
1586 and so on until one of the @var{try-completion} functions successfully
6ddfdbfcd361 (Completion Styles): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 102616
diff changeset
1587 performs completion and returns a non-@code{nil} value. A similar
6ddfdbfcd361 (Completion Styles): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 102616
diff changeset
1588 procedure is used for listing completions, via the
6ddfdbfcd361 (Completion Styles): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 102616
diff changeset
1589 @var{all-completions} functions.
6ddfdbfcd361 (Completion Styles): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 102616
diff changeset
1590 @end defvar
6ddfdbfcd361 (Completion Styles): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 102616
diff changeset
1591
106681
d937917bda79 * doc/emacs/misc.texi (Shell): Document async-shell-command.
Chong Yidong <cyd@stupidchicken.com>
parents: 106637
diff changeset
1592 By default, @code{completion-styles-alist} contains five pre-defined
102624
6ddfdbfcd361 (Completion Styles): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 102616
diff changeset
1593 completion styles: @code{basic}, a basic completion style;
6ddfdbfcd361 (Completion Styles): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 102616
diff changeset
1594 @code{partial-completion}, which does partial completion (completing
6ddfdbfcd361 (Completion Styles): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 102616
diff changeset
1595 each word in the input separately); @code{emacs22}, which performs
106681
d937917bda79 * doc/emacs/misc.texi (Shell): Document async-shell-command.
Chong Yidong <cyd@stupidchicken.com>
parents: 106637
diff changeset
1596 completion according to the rules used in Emacs 22; @code{emacs21},
d937917bda79 * doc/emacs/misc.texi (Shell): Document async-shell-command.
Chong Yidong <cyd@stupidchicken.com>
parents: 106637
diff changeset
1597 which performs completion according to the rules used in Emacs 21; and
d937917bda79 * doc/emacs/misc.texi (Shell): Document async-shell-command.
Chong Yidong <cyd@stupidchicken.com>
parents: 106637
diff changeset
1598 @code{initials}, which completes acronyms and initialisms.
102624
6ddfdbfcd361 (Completion Styles): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 102616
diff changeset
1599
84087
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1600 @node Programmed Completion
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1601 @subsection Programmed Completion
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1602 @cindex programmed completion
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1603
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1604 Sometimes it is not possible to create an alist or an obarray
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1605 containing all the intended possible completions. In such a case, you
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1606 can supply your own function to compute the completion of a given string.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1607 This is called @dfn{programmed completion}.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1608
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1609 To use this feature, pass a symbol with a function definition as the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1610 @var{collection} argument to @code{completing-read}. The function
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1611 @code{completing-read} arranges to pass your completion function along
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1612 to @code{try-completion} and @code{all-completions}, which will then let
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1613 your function do all the work.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1614
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1615 The completion function should accept three arguments:
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1616
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1617 @itemize @bullet
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1618 @item
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1619 The string to be completed.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1620
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1621 @item
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1622 The predicate function to filter possible matches, or @code{nil} if
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1623 none. Your function should call the predicate for each possible match,
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1624 and ignore the possible match if the predicate returns @code{nil}.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1625
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1626 @item
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1627 A flag specifying the type of operation.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1628 @end itemize
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1629
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1630 There are three flag values for three operations:
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1631
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1632 @itemize @bullet
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1633 @item
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1634 @code{nil} specifies @code{try-completion}. The completion function
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1635 should return the completion of the specified string, or @code{t} if the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1636 string is a unique and exact match already, or @code{nil} if the string
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1637 matches no possibility.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1638
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1639 If the string is an exact match for one possibility, but also matches
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1640 other longer possibilities, the function should return the string, not
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1641 @code{t}.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1642
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1643 @item
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1644 @code{t} specifies @code{all-completions}. The completion function
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1645 should return a list of all possible completions of the specified
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1646 string.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1647
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1648 @item
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1649 @code{lambda} specifies @code{test-completion}. The completion
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1650 function should return @code{t} if the specified string is an exact
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1651 match for some possibility; @code{nil} otherwise.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1652 @end itemize
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1653
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1654 It would be consistent and clean for completion functions to allow
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1655 lambda expressions (lists that are functions) as well as function
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1656 symbols as @var{collection}, but this is impossible. Lists as
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1657 completion tables already have other meanings, and it would be
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1658 unreliable to treat one differently just because it is also a possible
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1659 function. So you must arrange for any function you wish to use for
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1660 completion to be encapsulated in a symbol.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1661
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1662 Emacs uses programmed completion when completing file names.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1663 @xref{File Name Completion}.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1664
94180
114d8f4904d0 * minibuffer.el (completion-table-with-context): Add support for `pred'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 87649
diff changeset
1665 @defun completion-table-dynamic function
114d8f4904d0 * minibuffer.el (completion-table-with-context): Add support for `pred'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 87649
diff changeset
1666 This function is a convenient way to write a function that can act as
84087
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1667 programmed completion function. The argument @var{function} should be
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1668 a function that takes one argument, a string, and returns an alist of
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1669 possible completions of it. You can think of
94180
114d8f4904d0 * minibuffer.el (completion-table-with-context): Add support for `pred'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 87649
diff changeset
1670 @code{completion-table-dynamic} as a transducer between that interface
84087
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1671 and the interface for programmed completion functions.
94180
114d8f4904d0 * minibuffer.el (completion-table-with-context): Add support for `pred'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 87649
diff changeset
1672 @end defun
84087
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1673
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1674 @node Yes-or-No Queries
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1675 @section Yes-or-No Queries
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1676 @cindex asking the user questions
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1677 @cindex querying the user
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1678 @cindex yes-or-no questions
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1679
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1680 This section describes functions used to ask the user a yes-or-no
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1681 question. The function @code{y-or-n-p} can be answered with a single
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1682 character; it is useful for questions where an inadvertent wrong answer
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1683 will not have serious consequences. @code{yes-or-no-p} is suitable for
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1684 more momentous questions, since it requires three or four characters to
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1685 answer.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1686
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1687 If either of these functions is called in a command that was invoked
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1688 using the mouse---more precisely, if @code{last-nonmenu-event}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1689 (@pxref{Command Loop Info}) is either @code{nil} or a list---then it
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1690 uses a dialog box or pop-up menu to ask the question. Otherwise, it
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1691 uses keyboard input. You can force use of the mouse or use of keyboard
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1692 input by binding @code{last-nonmenu-event} to a suitable value around
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1693 the call.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1694
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1695 Strictly speaking, @code{yes-or-no-p} uses the minibuffer and
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1696 @code{y-or-n-p} does not; but it seems best to describe them together.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1697
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1698 @defun y-or-n-p prompt
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1699 This function asks the user a question, expecting input in the echo
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1700 area. It returns @code{t} if the user types @kbd{y}, @code{nil} if the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1701 user types @kbd{n}. This function also accepts @key{SPC} to mean yes
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1702 and @key{DEL} to mean no. It accepts @kbd{C-]} to mean ``quit,'' like
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1703 @kbd{C-g}, because the question might look like a minibuffer and for
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1704 that reason the user might try to use @kbd{C-]} to get out. The answer
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1705 is a single character, with no @key{RET} needed to terminate it. Upper
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1706 and lower case are equivalent.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1707
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1708 ``Asking the question'' means printing @var{prompt} in the echo area,
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1709 followed by the string @w{@samp{(y or n) }}. If the input is not one of
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1710 the expected answers (@kbd{y}, @kbd{n}, @kbd{@key{SPC}},
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1711 @kbd{@key{DEL}}, or something that quits), the function responds
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1712 @samp{Please answer y or n.}, and repeats the request.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1713
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1714 This function does not actually use the minibuffer, since it does not
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1715 allow editing of the answer. It actually uses the echo area (@pxref{The
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1716 Echo Area}), which uses the same screen space as the minibuffer. The
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1717 cursor moves to the echo area while the question is being asked.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1718
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1719 The answers and their meanings, even @samp{y} and @samp{n}, are not
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1720 hardwired. The keymap @code{query-replace-map} specifies them.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1721 @xref{Search and Replace}.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1722
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1723 In the following example, the user first types @kbd{q}, which is
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1724 invalid. At the next prompt the user types @kbd{y}.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1725
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1726 @smallexample
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1727 @group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1728 (y-or-n-p "Do you need a lift? ")
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1729
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1730 ;; @r{After evaluation of the preceding expression,}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1731 ;; @r{the following prompt appears in the echo area:}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1732 @end group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1733
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1734 @group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1735 ---------- Echo area ----------
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1736 Do you need a lift? (y or n)
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1737 ---------- Echo area ----------
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1738 @end group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1739
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1740 ;; @r{If the user then types @kbd{q}, the following appears:}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1741
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1742 @group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1743 ---------- Echo area ----------
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1744 Please answer y or n. Do you need a lift? (y or n)
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1745 ---------- Echo area ----------
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1746 @end group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1747
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1748 ;; @r{When the user types a valid answer,}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1749 ;; @r{it is displayed after the question:}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1750
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1751 @group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1752 ---------- Echo area ----------
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1753 Do you need a lift? (y or n) y
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1754 ---------- Echo area ----------
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1755 @end group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1756 @end smallexample
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1757
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1758 @noindent
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1759 We show successive lines of echo area messages, but only one actually
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1760 appears on the screen at a time.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1761 @end defun
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1762
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1763 @defun y-or-n-p-with-timeout prompt seconds default-value
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1764 Like @code{y-or-n-p}, except that if the user fails to answer within
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1765 @var{seconds} seconds, this function stops waiting and returns
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1766 @var{default-value}. It works by setting up a timer; see @ref{Timers}.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1767 The argument @var{seconds} may be an integer or a floating point number.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1768 @end defun
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1769
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1770 @defun yes-or-no-p prompt
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1771 This function asks the user a question, expecting input in the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1772 minibuffer. It returns @code{t} if the user enters @samp{yes},
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1773 @code{nil} if the user types @samp{no}. The user must type @key{RET} to
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1774 finalize the response. Upper and lower case are equivalent.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1775
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1776 @code{yes-or-no-p} starts by displaying @var{prompt} in the echo area,
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1777 followed by @w{@samp{(yes or no) }}. The user must type one of the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1778 expected responses; otherwise, the function responds @samp{Please answer
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1779 yes or no.}, waits about two seconds and repeats the request.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1780
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1781 @code{yes-or-no-p} requires more work from the user than
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1782 @code{y-or-n-p} and is appropriate for more crucial decisions.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1783
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1784 Here is an example:
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1785
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1786 @smallexample
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1787 @group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1788 (yes-or-no-p "Do you really want to remove everything? ")
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1789
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1790 ;; @r{After evaluation of the preceding expression,}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1791 ;; @r{the following prompt appears,}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1792 ;; @r{with an empty minibuffer:}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1793 @end group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1794
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1795 @group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1796 ---------- Buffer: minibuffer ----------
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1797 Do you really want to remove everything? (yes or no)
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1798 ---------- Buffer: minibuffer ----------
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1799 @end group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1800 @end smallexample
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1801
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1802 @noindent
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1803 If the user first types @kbd{y @key{RET}}, which is invalid because this
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1804 function demands the entire word @samp{yes}, it responds by displaying
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1805 these prompts, with a brief pause between them:
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1806
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1807 @smallexample
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1808 @group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1809 ---------- Buffer: minibuffer ----------
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1810 Please answer yes or no.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1811 Do you really want to remove everything? (yes or no)
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1812 ---------- Buffer: minibuffer ----------
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1813 @end group
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1814 @end smallexample
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1815 @end defun
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1816
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1817 @node Multiple Queries
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1818 @section Asking Multiple Y-or-N Questions
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1819
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1820 When you have a series of similar questions to ask, such as ``Do you
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1821 want to save this buffer'' for each buffer in turn, you should use
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1822 @code{map-y-or-n-p} to ask the collection of questions, rather than
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1823 asking each question individually. This gives the user certain
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1824 convenient facilities such as the ability to answer the whole series at
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1825 once.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1826
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1827 @defun map-y-or-n-p prompter actor list &optional help action-alist no-cursor-in-echo-area
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1828 This function asks the user a series of questions, reading a
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1829 single-character answer in the echo area for each one.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1830
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1831 The value of @var{list} specifies the objects to ask questions about.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1832 It should be either a list of objects or a generator function. If it is
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1833 a function, it should expect no arguments, and should return either the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1834 next object to ask about, or @code{nil} meaning stop asking questions.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1835
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1836 The argument @var{prompter} specifies how to ask each question. If
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1837 @var{prompter} is a string, the question text is computed like this:
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1838
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1839 @example
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1840 (format @var{prompter} @var{object})
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1841 @end example
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1842
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1843 @noindent
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1844 where @var{object} is the next object to ask about (as obtained from
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1845 @var{list}).
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1846
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1847 If not a string, @var{prompter} should be a function of one argument
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1848 (the next object to ask about) and should return the question text. If
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1849 the value is a string, that is the question to ask the user. The
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1850 function can also return @code{t} meaning do act on this object (and
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1851 don't ask the user), or @code{nil} meaning ignore this object (and don't
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1852 ask the user).
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1853
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1854 The argument @var{actor} says how to act on the answers that the user
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1855 gives. It should be a function of one argument, and it is called with
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1856 each object that the user says yes for. Its argument is always an
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1857 object obtained from @var{list}.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1858
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1859 If the argument @var{help} is given, it should be a list of this form:
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1860
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1861 @example
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1862 (@var{singular} @var{plural} @var{action})
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1863 @end example
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1864
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1865 @noindent
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1866 where @var{singular} is a string containing a singular noun that
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1867 describes the objects conceptually being acted on, @var{plural} is the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1868 corresponding plural noun, and @var{action} is a transitive verb
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1869 describing what @var{actor} does.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1870
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1871 If you don't specify @var{help}, the default is @code{("object"
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1872 "objects" "act on")}.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1873
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1874 Each time a question is asked, the user may enter @kbd{y}, @kbd{Y}, or
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1875 @key{SPC} to act on that object; @kbd{n}, @kbd{N}, or @key{DEL} to skip
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1876 that object; @kbd{!} to act on all following objects; @key{ESC} or
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1877 @kbd{q} to exit (skip all following objects); @kbd{.} (period) to act on
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1878 the current object and then exit; or @kbd{C-h} to get help. These are
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1879 the same answers that @code{query-replace} accepts. The keymap
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1880 @code{query-replace-map} defines their meaning for @code{map-y-or-n-p}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1881 as well as for @code{query-replace}; see @ref{Search and Replace}.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1882
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1883 You can use @var{action-alist} to specify additional possible answers
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1884 and what they mean. It is an alist of elements of the form
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1885 @code{(@var{char} @var{function} @var{help})}, each of which defines one
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1886 additional answer. In this element, @var{char} is a character (the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1887 answer); @var{function} is a function of one argument (an object from
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1888 @var{list}); @var{help} is a string.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1889
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1890 When the user responds with @var{char}, @code{map-y-or-n-p} calls
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1891 @var{function}. If it returns non-@code{nil}, the object is considered
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1892 ``acted upon,'' and @code{map-y-or-n-p} advances to the next object in
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1893 @var{list}. If it returns @code{nil}, the prompt is repeated for the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1894 same object.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1895
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1896 Normally, @code{map-y-or-n-p} binds @code{cursor-in-echo-area} while
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1897 prompting. But if @var{no-cursor-in-echo-area} is non-@code{nil}, it
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1898 does not do that.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1899
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1900 If @code{map-y-or-n-p} is called in a command that was invoked using the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1901 mouse---more precisely, if @code{last-nonmenu-event} (@pxref{Command
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1902 Loop Info}) is either @code{nil} or a list---then it uses a dialog box
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1903 or pop-up menu to ask the question. In this case, it does not use
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1904 keyboard input or the echo area. You can force use of the mouse or use
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1905 of keyboard input by binding @code{last-nonmenu-event} to a suitable
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1906 value around the call.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1907
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1908 The return value of @code{map-y-or-n-p} is the number of objects acted on.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1909 @end defun
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1910
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1911 @node Reading a Password
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1912 @section Reading a Password
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1913 @cindex passwords, reading
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1914
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1915 To read a password to pass to another program, you can use the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1916 function @code{read-passwd}.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1917
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1918 @defun read-passwd prompt &optional confirm default
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1919 This function reads a password, prompting with @var{prompt}. It does
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1920 not echo the password as the user types it; instead, it echoes @samp{.}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1921 for each character in the password.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1922
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1923 The optional argument @var{confirm}, if non-@code{nil}, says to read the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1924 password twice and insist it must be the same both times. If it isn't
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1925 the same, the user has to type it over and over until the last two
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1926 times match.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1927
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1928 The optional argument @var{default} specifies the default password to
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1929 return if the user enters empty input. If @var{default} is @code{nil},
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1930 then @code{read-passwd} returns the null string in that case.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1931 @end defun
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1932
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1933 @node Minibuffer Commands
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1934 @section Minibuffer Commands
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1935
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1936 This section describes some commands meant for use in the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1937 minibuffer.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1938
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1939 @deffn Command exit-minibuffer
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1940 This command exits the active minibuffer. It is normally bound to
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1941 keys in minibuffer local keymaps.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1942 @end deffn
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1943
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1944 @deffn Command self-insert-and-exit
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1945 This command exits the active minibuffer after inserting the last
101017
572b8f2e775c (Minibuffer Commands): Use last-command-event rather than last-command-char.
Glenn Morris <rgm@gnu.org>
parents: 100974
diff changeset
1946 character typed on the keyboard (found in @code{last-command-event};
84087
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1947 @pxref{Command Loop Info}).
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1948 @end deffn
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1949
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1950 @deffn Command previous-history-element n
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1951 This command replaces the minibuffer contents with the value of the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1952 @var{n}th previous (older) history element.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1953 @end deffn
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1954
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1955 @deffn Command next-history-element n
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1956 This command replaces the minibuffer contents with the value of the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1957 @var{n}th more recent history element.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1958 @end deffn
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1959
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1960 @deffn Command previous-matching-history-element pattern n
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1961 This command replaces the minibuffer contents with the value of the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1962 @var{n}th previous (older) history element that matches @var{pattern} (a
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1963 regular expression).
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1964 @end deffn
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1965
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1966 @deffn Command next-matching-history-element pattern n
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1967 This command replaces the minibuffer contents with the value of the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1968 @var{n}th next (newer) history element that matches @var{pattern} (a
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1969 regular expression).
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1970 @end deffn
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1971
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1972 @node Minibuffer Windows
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1973 @section Minibuffer Windows
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1974 @cindex minibuffer windows
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1975
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1976 These functions access and select minibuffer windows
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1977 and test whether they are active.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1978
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1979 @defun active-minibuffer-window
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1980 This function returns the currently active minibuffer window, or
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1981 @code{nil} if none is currently active.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1982 @end defun
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1983
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1984 @defun minibuffer-window &optional frame
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1985 @anchor{Definition of minibuffer-window}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1986 This function returns the minibuffer window used for frame @var{frame}.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1987 If @var{frame} is @code{nil}, that stands for the current frame. Note
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1988 that the minibuffer window used by a frame need not be part of that
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1989 frame---a frame that has no minibuffer of its own necessarily uses some
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1990 other frame's minibuffer window.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1991 @end defun
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1992
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1993 @defun set-minibuffer-window window
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1994 This function specifies @var{window} as the minibuffer window to use.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1995 This affects where the minibuffer is displayed if you put text in it
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1996 without invoking the usual minibuffer commands. It has no effect on
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1997 the usual minibuffer input functions because they all start by
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1998 choosing the minibuffer window according to the current frame.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1999 @end defun
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2000
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2001 @c Emacs 19 feature
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2002 @defun window-minibuffer-p &optional window
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2003 This function returns non-@code{nil} if @var{window} is a minibuffer
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2004 window.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2005 @var{window} defaults to the selected window.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2006 @end defun
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2007
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2008 It is not correct to determine whether a given window is a minibuffer by
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2009 comparing it with the result of @code{(minibuffer-window)}, because
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2010 there can be more than one minibuffer window if there is more than one
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2011 frame.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2012
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2013 @defun minibuffer-window-active-p window
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2014 This function returns non-@code{nil} if @var{window}, assumed to be
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2015 a minibuffer window, is currently active.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2016 @end defun
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2017
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2018 @node Minibuffer Contents
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2019 @section Minibuffer Contents
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2020
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2021 These functions access the minibuffer prompt and contents.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2022
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2023 @defun minibuffer-prompt
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2024 This function returns the prompt string of the currently active
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2025 minibuffer. If no minibuffer is active, it returns @code{nil}.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2026 @end defun
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2027
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2028 @defun minibuffer-prompt-end
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2029 This function returns the current
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2030 position of the end of the minibuffer prompt, if a minibuffer is
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2031 current. Otherwise, it returns the minimum valid buffer position.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2032 @end defun
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2033
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2034 @defun minibuffer-prompt-width
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2035 This function returns the current display-width of the minibuffer
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2036 prompt, if a minibuffer is current. Otherwise, it returns zero.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2037 @end defun
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2038
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2039 @defun minibuffer-contents
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2040 This function returns the editable
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2041 contents of the minibuffer (that is, everything except the prompt) as
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2042 a string, if a minibuffer is current. Otherwise, it returns the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2043 entire contents of the current buffer.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2044 @end defun
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2045
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2046 @defun minibuffer-contents-no-properties
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2047 This is like @code{minibuffer-contents}, except that it does not copy text
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2048 properties, just the characters themselves. @xref{Text Properties}.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2049 @end defun
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2050
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2051 @defun minibuffer-completion-contents
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2052 This is like @code{minibuffer-contents}, except that it returns only
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2053 the contents before point. That is the part that completion commands
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2054 operate on. @xref{Minibuffer Completion}.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2055 @end defun
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2056
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2057 @defun delete-minibuffer-contents
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2058 This function erases the editable contents of the minibuffer (that is,
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2059 everything except the prompt), if a minibuffer is current. Otherwise,
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2060 it erases the entire current buffer.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2061 @end defun
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2062
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2063 @node Recursive Mini
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2064 @section Recursive Minibuffers
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2065 @cindex recursive minibuffers
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2066
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2067 These functions and variables deal with recursive minibuffers
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2068 (@pxref{Recursive Editing}):
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2069
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2070 @defun minibuffer-depth
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2071 This function returns the current depth of activations of the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2072 minibuffer, a nonnegative integer. If no minibuffers are active, it
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2073 returns zero.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2074 @end defun
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2075
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2076 @defopt enable-recursive-minibuffers
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2077 If this variable is non-@code{nil}, you can invoke commands (such as
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2078 @code{find-file}) that use minibuffers even while the minibuffer window
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2079 is active. Such invocation produces a recursive editing level for a new
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2080 minibuffer. The outer-level minibuffer is invisible while you are
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2081 editing the inner one.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2082
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2083 If this variable is @code{nil}, you cannot invoke minibuffer
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2084 commands when the minibuffer window is active, not even if you switch to
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2085 another window to do it.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2086 @end defopt
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2087
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2088 @c Emacs 19 feature
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2089 If a command name has a property @code{enable-recursive-minibuffers}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2090 that is non-@code{nil}, then the command can use the minibuffer to read
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2091 arguments even if it is invoked from the minibuffer. A command can
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2092 also achieve this by binding @code{enable-recursive-minibuffers}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2093 to @code{t} in the interactive declaration (@pxref{Using Interactive}).
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2094 The minibuffer command @code{next-matching-history-element} (normally
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2095 @kbd{M-s} in the minibuffer) does the latter.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2096
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2097 @node Minibuffer Misc
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2098 @section Minibuffer Miscellany
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2099
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2100 @defun minibufferp &optional buffer-or-name
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2101 This function returns non-@code{nil} if @var{buffer-or-name} is a
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2102 minibuffer. If @var{buffer-or-name} is omitted, it tests the current
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2103 buffer.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2104 @end defun
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2105
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2106 @defvar minibuffer-setup-hook
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2107 This is a normal hook that is run whenever the minibuffer is entered.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2108 @xref{Hooks}.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2109 @end defvar
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2110
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2111 @defvar minibuffer-exit-hook
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2112 This is a normal hook that is run whenever the minibuffer is exited.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2113 @xref{Hooks}.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2114 @end defvar
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2115
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2116 @defvar minibuffer-help-form
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2117 @anchor{Definition of minibuffer-help-form}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2118 The current value of this variable is used to rebind @code{help-form}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2119 locally inside the minibuffer (@pxref{Help Functions}).
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2120 @end defvar
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2121
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2122 @defvar minibuffer-scroll-window
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2123 @anchor{Definition of minibuffer-scroll-window}
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2124 If the value of this variable is non-@code{nil}, it should be a window
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2125 object. When the function @code{scroll-other-window} is called in the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2126 minibuffer, it scrolls this window.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2127 @end defvar
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2128
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2129 @defun minibuffer-selected-window
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2130 This function returns the window which was selected when the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2131 minibuffer was entered. If selected window is not a minibuffer
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2132 window, it returns @code{nil}.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2133 @end defun
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2134
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2135 @defopt max-mini-window-height
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2136 This variable specifies the maximum height for resizing minibuffer
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2137 windows. If a float, it specifies a fraction of the height of the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2138 frame. If an integer, it specifies a number of lines.
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2139 @end defopt
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2140
103264
b269cabac20c * syntax.texi (Position Parse): Document rationale for ignored
Chong Yidong <cyd@stupidchicken.com>
parents: 102703
diff changeset
2141 @defun minibuffer-message string &rest args
84087
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2142 This function displays @var{string} temporarily at the end of the
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2143 minibuffer text, for two seconds, or until the next input event
103264
b269cabac20c * syntax.texi (Position Parse): Document rationale for ignored
Chong Yidong <cyd@stupidchicken.com>
parents: 102703
diff changeset
2144 arrives, whichever comes first. If @var{args} is non-@code{nil}, the
b269cabac20c * syntax.texi (Position Parse): Document rationale for ignored
Chong Yidong <cyd@stupidchicken.com>
parents: 102703
diff changeset
2145 actual message is obtained by passing @var{string} and @var{args}
b269cabac20c * syntax.texi (Position Parse): Document rationale for ignored
Chong Yidong <cyd@stupidchicken.com>
parents: 102703
diff changeset
2146 through @code{format}. @xref{Formatting Strings}.
84087
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2147 @end defun
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2148
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2149 @ignore
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2150 arch-tag: bba7f945-9078-477f-a2ce-18818a6e1218
aa6ce8057bdb Move here from ../../lispref
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2151 @end ignore