comparison lisp/complete.el @ 53258:f94a302ee4c0

(PC-is-complete-p): delete. (PC-do-completion): Replace all calls to `PC-is-complete-p' with calls to `test-completion'.
author Luc Teirlinck <teirllm@auburn.edu>
date Tue, 23 Dec 2003 23:42:28 +0000
parents cc2b636ab1db
children 242e5edee3ce
comparison
equal deleted inserted replaced
53257:869dfa7b9022 53258:f94a302ee4c0
366 helpposs 366 helpposs
367 (case-fold-search completion-ignore-case)) 367 (case-fold-search completion-ignore-case))
368 368
369 ;; Check if buffer contents can already be considered complete 369 ;; Check if buffer contents can already be considered complete
370 (if (and (eq mode 'exit) 370 (if (and (eq mode 'exit)
371 (PC-is-complete-p str table pred)) 371 (test-completion str table pred))
372 'complete 372 'complete
373 373
374 ;; Do substitutions in directory names 374 ;; Do substitutions in directory names
375 (and filename 375 (and filename
376 (setq basestr (or (file-name-directory str) "")) 376 (setq basestr (or (file-name-directory str) ""))
639 (not PC-word-failed-flag)) 639 (not PC-word-failed-flag))
640 640
641 (if improved 641 (if improved
642 642
643 ;; We changed it... would it be complete without the space? 643 ;; We changed it... would it be complete without the space?
644 (if (PC-is-complete-p (buffer-substring 1 (1- end)) 644 (if (test-completion (buffer-substring 1 (1- end))
645 table pred) 645 table pred)
646 (delete-region (1- end) end))) 646 (delete-region (1- end) end)))
647 647
648 (if improved 648 (if improved
649 649
650 ;; We changed it... enough to be complete? 650 ;; We changed it... enough to be complete?
651 (and (eq mode 'exit) 651 (and (eq mode 'exit)
652 (PC-is-complete-p (field-string) table pred)) 652 (test-completion (field-string) table pred))
653 653
654 ;; If totally ambiguous, display a list of completions 654 ;; If totally ambiguous, display a list of completions
655 (if (or (eq completion-auto-help t) 655 (if (or (eq completion-auto-help t)
656 (and completion-auto-help 656 (and completion-auto-help
657 (eq last-command this-command)) 657 (eq last-command this-command))
677 (insert (format "%s" 677 (insert (format "%s"
678 (if filename 678 (if filename
679 (substitute-in-file-name (concat dirname (car poss))) 679 (substitute-in-file-name (concat dirname (car poss)))
680 (car poss))))) 680 (car poss)))))
681 t))))) 681 t)))))
682
683
684 (defun PC-is-complete-p (str table pred)
685 (let ((res (if (listp table)
686 (assoc str table)
687 (if (vectorp table)
688 (or (equal str "nil") ; heh, heh, heh
689 (intern-soft str table))
690 (funcall table str pred 'lambda)))))
691 (and res
692 (or (not pred)
693 (and (not (listp table)) (not (vectorp table)))
694 (funcall pred res))
695 res)))
696 682
697 (defun PC-chop-word (new old) 683 (defun PC-chop-word (new old)
698 (let ((i -1) 684 (let ((i -1)
699 (j -1)) 685 (j -1))
700 (while (and (setq i (string-match PC-delim-regex old (1+ i))) 686 (while (and (setq i (string-match PC-delim-regex old (1+ i)))