diff options
| author | Stefan Monnier | 2009-08-30 15:13:35 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2009-08-30 15:13:35 +0000 |
| commit | 73ebf88f15539765b5cfb628791408845a240637 (patch) | |
| tree | 365bec1d97c27f95e2bd948da14b820ff0bf5295 /lisp | |
| parent | 80629cfce13fe1751335fbb64f360894861cc400 (diff) | |
| download | emacs-73ebf88f15539765b5cfb628791408845a240637.tar.gz emacs-73ebf88f15539765b5cfb628791408845a240637.zip | |
(field-complete): Use minibuffer-complete.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/ChangeLog | 2 | ||||
| -rw-r--r-- | lisp/emacs-lisp/lisp.el | 47 |
2 files changed, 12 insertions, 37 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index f2c2fbda65e..d5c3bc92674 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,7 @@ | |||
| 1 | 2009-08-30 Stefan Monnier <monnier@iro.umontreal.ca> | 1 | 2009-08-30 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 2 | ||
| 3 | * emacs-lisp/lisp.el (field-complete): Use minibuffer-complete. | ||
| 4 | |||
| 3 | * net/ldap.el (ldap-search-internal): Use with-current-buffer and push. | 5 | * net/ldap.el (ldap-search-internal): Use with-current-buffer and push. |
| 4 | 6 | ||
| 5 | * net/imap.el (imap-send-command): Simplify. | 7 | * net/imap.el (imap-send-command): Simplify. |
diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el index f586382afd3..107770a3b00 100644 --- a/lisp/emacs-lisp/lisp.el +++ b/lisp/emacs-lisp/lisp.el | |||
| @@ -597,43 +597,16 @@ character." | |||
| 597 | (error "Unmatched bracket or quote")))) | 597 | (error "Unmatched bracket or quote")))) |
| 598 | 598 | ||
| 599 | (defun field-complete (table &optional predicate) | 599 | (defun field-complete (table &optional predicate) |
| 600 | (let* ((pattern (field-string-no-properties)) | 600 | (let ((minibuffer-completion-table table) |
| 601 | (completion (try-completion pattern table predicate))) | 601 | (minibuffer-completion-predicate predicate) |
| 602 | (cond ((eq completion t)) | 602 | ;; This made sense for lisp-complete-symbol, but for |
| 603 | ((null completion) | 603 | ;; field-complete, this is out of place. --Stef |
| 604 | (message "Can't find completion for \"%s\"" pattern) | 604 | ;; (completion-annotate-function |
| 605 | (ding)) | 605 | ;; (unless (eq predicate 'fboundp) |
| 606 | ((not (string= pattern completion)) | 606 | ;; (lambda (str) |
| 607 | (delete-region (field-beginning) (field-end)) | 607 | ;; (if (fboundp (intern-soft str)) " <f>")))) |
| 608 | (insert completion) | 608 | ) |
| 609 | ;; Don't leave around a completions buffer that's out of date. | 609 | (call-interactively 'minibuffer-complete))) |
| 610 | (let ((win (get-buffer-window "*Completions*" 0))) | ||
| 611 | (if win (with-selected-window win (bury-buffer))))) | ||
| 612 | (t | ||
| 613 | (let ((minibuf-is-in-use | ||
| 614 | (eq (minibuffer-window) (selected-window)))) | ||
| 615 | (unless minibuf-is-in-use | ||
| 616 | (message "Making completion list...")) | ||
| 617 | (let ((list (all-completions pattern table predicate))) | ||
| 618 | (setq list (sort list 'string<)) | ||
| 619 | (or (eq predicate 'fboundp) | ||
| 620 | (let (new) | ||
| 621 | (while list | ||
| 622 | (setq new (cons (if (fboundp (intern (car list))) | ||
| 623 | (list (car list) " <f>") | ||
| 624 | (car list)) | ||
| 625 | new)) | ||
| 626 | (setq list (cdr list))) | ||
| 627 | (setq list (nreverse new)))) | ||
| 628 | (if (> (length list) 1) | ||
| 629 | (with-output-to-temp-buffer "*Completions*" | ||
| 630 | (display-completion-list list pattern)) | ||
| 631 | ;; Don't leave around a completions buffer that's | ||
| 632 | ;; out of date. | ||
| 633 | (let ((win (get-buffer-window "*Completions*" 0))) | ||
| 634 | (if win (with-selected-window win (bury-buffer)))))) | ||
| 635 | (unless minibuf-is-in-use | ||
| 636 | (message "Making completion list...%s" "done"))))))) | ||
| 637 | 610 | ||
| 638 | (defun lisp-complete-symbol (&optional predicate) | 611 | (defun lisp-complete-symbol (&optional predicate) |
| 639 | "Perform completion on Lisp symbol preceding point. | 612 | "Perform completion on Lisp symbol preceding point. |