From 337e26b6c37b31c196c84e0cccc451ef1336911c Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Mon, 29 Dec 2014 18:39:26 -0500 Subject: [PATCH] Inform user when no completions remain --- rmacs/minibuf.rkt | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/rmacs/minibuf.rkt b/rmacs/minibuf.rkt index eb554f7..ddf8792 100644 --- a/rmacs/minibuf.rkt +++ b/rmacs/minibuf.rkt @@ -127,20 +127,21 @@ (define unfiltered-completions ((completing-read-completion-hook buf) prefix string=?)) (define completions (filter (lambda (s) (string-prefix? prefix s string=?)) unfiltered-completions)) - (when (pair? completions) - (define common-prefix (common-string-prefix completions string=?)) - (define complete? (null? (cdr completions))) - (if (string=? common-prefix prefix) - ;; No progress. - (if complete? - (message ed "Sole completion") - (message ed "Completions: ~a" completions)) - ;; Some progress - (buffer-region-update! buf - recursive-edit-field-start - (buffer-size buf) - (lambda (_old) - (string->rope common-prefix)))))) + (if (pair? completions) + (let ((common-prefix (common-string-prefix completions string=?)) + (complete? (null? (cdr completions)))) + (if (string=? common-prefix prefix) + ;; No progress. + (if complete? + (message ed "Sole completion") + (message ed "Completions: ~a" completions)) + ;; Some progress + (buffer-region-update! buf + recursive-edit-field-start + (buffer-size buf) + (lambda (_old) + (string->rope common-prefix))))) + (message ed "No match"))) (define-command completing-read-mode (exit-minibuffer buf #:next-method next-method