Mercurial > emacs
comparison lisp/complete.el @ 10164:d16e46a4e34c
(PC-do-completion): If complete but not unique,
the second time in a row, give a list of completions.
(PC-do-complete-and-exit, PC-do-completion): Use [...] in messages.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Thu, 15 Dec 1994 02:00:11 +0000 |
parents | 9d3d84a3c3fa |
children | 577cd5d36667 |
comparison
equal
deleted
inserted
replaced
10163:70b04b218216 | 10164:d16e46a4e34c |
---|---|
226 (let ((flag (PC-do-completion 'exit))) | 226 (let ((flag (PC-do-completion 'exit))) |
227 (and flag | 227 (and flag |
228 (if (or (eq flag 'complete) | 228 (if (or (eq flag 'complete) |
229 (not minibuffer-completion-confirm)) | 229 (not minibuffer-completion-confirm)) |
230 (exit-minibuffer) | 230 (exit-minibuffer) |
231 (PC-temp-minibuffer-message " (Confirm)")))))) | 231 (PC-temp-minibuffer-message " [Confirm]")))))) |
232 | 232 |
233 | 233 |
234 (defun PC-completion-help () | 234 (defun PC-completion-help () |
235 "Like `minibuffer-completion-help', but allows \"b--di\"-style abbreviations. | 235 "Like `minibuffer-completion-help', but allows \"b--di\"-style abbreviations. |
236 See `PC-complete' for details." | 236 See `PC-complete' for details." |
398 (let ((PC-word-failed-flag t)) | 398 (let ((PC-word-failed-flag t)) |
399 (delete-backward-char 1) | 399 (delete-backward-char 1) |
400 (PC-do-completion 'word)) | 400 (PC-do-completion 'word)) |
401 (beep) | 401 (beep) |
402 (PC-temp-minibuffer-message (if ambig | 402 (PC-temp-minibuffer-message (if ambig |
403 " (Ambiguous dir name)" | 403 " [Ambiguous dir name]" |
404 (if (eq mode 'help) | 404 (if (eq mode 'help) |
405 " (No completions)" | 405 " [No completions]" |
406 " (No match)"))) | 406 " [No match]"))) |
407 nil)) | 407 nil)) |
408 | 408 |
409 ;; More than one valid completion found | 409 ;; More than one valid completion found |
410 ((or (cdr (setq helpposs poss)) | 410 ((or (cdr (setq helpposs poss)) |
411 (memq mode '(help word))) | 411 (memq mode '(help word))) |
439 ;; Is the actual string one of the possible completions? | 439 ;; Is the actual string one of the possible completions? |
440 (setq p (and (not (eq mode 'help)) poss)) | 440 (setq p (and (not (eq mode 'help)) poss)) |
441 (while (and p | 441 (while (and p |
442 (not (equal (car p) basestr))) | 442 (not (equal (car p) basestr))) |
443 (setq p (cdr p))) | 443 (setq p (cdr p))) |
444 (if p | 444 (and p (null mode) |
445 | 445 (PC-temp-minibuffer-message " [Complete, but not unique]")) |
446 (progn | 446 (if (and p |
447 (if (null mode) | 447 (not (and (null mode) |
448 (PC-temp-minibuffer-message " (Complete, but not unique)")) | 448 (eq this-command last-command)))) |
449 t) | 449 t |
450 | 450 |
451 ;; If ambiguous, try for a partial completion | 451 ;; If ambiguous, try for a partial completion |
452 (let ((improved nil) | 452 (let ((improved nil) |
453 prefix | 453 prefix |
454 (pt nil) | 454 (pt nil) |
537 (set-buffer standard-output) | 537 (set-buffer standard-output) |
538 ;; Record which part of the buffer we are completing | 538 ;; Record which part of the buffer we are completing |
539 ;; so that choosing a completion from the list | 539 ;; so that choosing a completion from the list |
540 ;; knows how much old text to replace. | 540 ;; knows how much old text to replace. |
541 (setq completion-base-size dirlength))) | 541 (setq completion-base-size dirlength))) |
542 (PC-temp-minibuffer-message " (Next char not unique)")) | 542 (PC-temp-minibuffer-message " [Next char not unique]")) |
543 nil))))) | 543 nil))))) |
544 | 544 |
545 ;; Only one possible completion | 545 ;; Only one possible completion |
546 (t | 546 (t |
547 (if (equal basestr (car poss)) | 547 (if (equal basestr (car poss)) |
548 (if (null mode) | 548 (if (null mode) |
549 (PC-temp-minibuffer-message " (Sole completion)")) | 549 (PC-temp-minibuffer-message " [Sole completion]")) |
550 (delete-region beg end) | 550 (delete-region beg end) |
551 (insert (format "%s" | 551 (insert (format "%s" |
552 (if filename | 552 (if filename |
553 (substitute-in-file-name (concat dirname (car poss))) | 553 (substitute-in-file-name (concat dirname (car poss))) |
554 (car poss))))) | 554 (car poss))))) |