diff options
| author | Juri Linkov | 2026-04-16 20:12:03 +0300 |
|---|---|---|
| committer | Juri Linkov | 2026-04-16 20:12:03 +0300 |
| commit | d88e73d047367bc76e4ecec7fdd00c70d7d4ea13 (patch) | |
| tree | 5feffecf386d9d1e57287ba6f5e50af36e92e44e | |
| parent | 126eab79b08bcb88c27fc9fef32012584d54541b (diff) | |
| download | emacs-d88e73d047367bc76e4ecec7fdd00c70d7d4ea13.tar.gz emacs-d88e73d047367bc76e4ecec7fdd00c70d7d4ea13.zip | |
Update 'crm-complete-and-exit' from 'minibuffer-complete-and-exit'
* lisp/emacs-lisp/crm.el (crm-complete-and-exit):
Add new arg 'no-exit'. Call 'minibuffer-choose-completion'
when 'completion--selected-candidate' returns non-nil (bug#80821).
| -rw-r--r-- | lisp/emacs-lisp/crm.el | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lisp/emacs-lisp/crm.el b/lisp/emacs-lisp/crm.el index a1c7175fc66..39a01490365 100644 --- a/lisp/emacs-lisp/crm.el +++ b/lisp/emacs-lisp/crm.el | |||
| @@ -192,14 +192,21 @@ Like `minibuffer-complete-word' but for `completing-read-multiple'." | |||
| 192 | (crm--completion-command beg end | 192 | (crm--completion-command beg end |
| 193 | (completion-in-region--single-word beg end))) | 193 | (completion-in-region--single-word beg end))) |
| 194 | 194 | ||
| 195 | (defun crm-complete-and-exit () | 195 | (defun crm-complete-and-exit (&optional no-exit) |
| 196 | "If all of the minibuffer elements are valid completions then exit. | 196 | "If all of the minibuffer elements are valid completions then exit. |
| 197 | All elements in the minibuffer must match. If there is a mismatch, move point | 197 | All elements in the minibuffer must match. If there is a mismatch, move point |
| 198 | to the location of mismatch and do not exit. | 198 | to the location of mismatch and do not exit. |
| 199 | 199 | ||
| 200 | If a completion candidate is selected in the *Completions* buffer, it | ||
| 201 | will be inserted in the minibuffer first. If NO-EXIT is non-nil, don't | ||
| 202 | actually exit the minibuffer, just insert the selected completion if | ||
| 203 | any. | ||
| 204 | |||
| 200 | This function is modeled after `minibuffer-complete-and-exit'." | 205 | This function is modeled after `minibuffer-complete-and-exit'." |
| 201 | (interactive) | 206 | (interactive "P") |
| 202 | (let ((doexit t)) | 207 | (when (completion--selected-candidate) |
| 208 | (minibuffer-choose-completion t t)) | ||
| 209 | (let ((doexit (not no-exit))) | ||
| 203 | (goto-char (minibuffer-prompt-end)) | 210 | (goto-char (minibuffer-prompt-end)) |
| 204 | (while | 211 | (while |
| 205 | (and doexit | 212 | (and doexit |