Changeset 4018 for vendor/emacs-CVS_HEAD/lisp/complete.el
- Timestamp:
- 01/28/06 09:46:44 (3 years ago)
- Files:
-
- vendor/emacs-CVS_HEAD/lisp/complete.el (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
vendor/emacs-CVS_HEAD/lisp/complete.el
r3988 r4018 207 207 208 208 Partial Completion mode extends the meaning of `completion-auto-help' (which 209 see) so that if it is neither nil nor t, Emacs will show the *Completions* 210 buffer only on the second attempt to complete. I.e. if TAB finds nothing 211 to complete, the first TAB will just say \"Next char not unique\" without 212 bringing up the *Completions* buffer, and the second TAB will then bring up 213 the *Completions* buffer." 209 see), so that if it is neither nil nor t, Emacs shows the `*Completions*' 210 buffer only on the second attempt to complete. That is, if TAB finds nothing 211 to complete, the first TAB just says \"Next char not unique\" and the 212 second TAB brings up the `*Completions*' buffer." 214 213 :global t :group 'partial-completion 215 214 ;; Deal with key bindings... … … 217 216 ;; Deal with include file feature... 218 217 (cond ((not partial-completion-mode) 219 (remove-hook 'find-file-not-found- hooks 'PC-look-for-include-file))218 (remove-hook 'find-file-not-found-functions 'PC-look-for-include-file)) 220 219 ((not PC-disable-includes) 221 (add-hook 'find-file-not-found- hooks 'PC-look-for-include-file)))220 (add-hook 'find-file-not-found-functions 'PC-look-for-include-file))) 222 221 ;; ... with some underhand redefining. 223 222 (cond ((and (not partial-completion-mode) … … 262 261 (if (and window (window-buffer window) 263 262 (buffer-name (window-buffer window))) 264 (save-excursion 265 (set-buffer (window-buffer window)) 263 (with-current-buffer (window-buffer window) 266 264 (if (pos-visible-in-window-p (point-max) window) 267 265 (set-window-start window (point-min) nil) … … 347 345 348 346 (defvar PC-completion-as-file-name-predicate 349 (function 350 (lambda () 351 (memq minibuffer-completion-table 352 '(read-file-name-internal read-directory-name-internal)))) 353 "A function testing whether a minibuffer completion now will work filename-style. 347 (lambda () minibuffer-completing-file-name) 348 "A function testing whether a minibuffer completion now will work filename-style. 354 349 The function takes no arguments, and typically looks at the value 355 350 of `minibuffer-completion-table' and the minibuffer contents.") … … 618 613 (setq end (1+ end))) 619 614 (setq i (1+ i))) 620 (or pt (equal (point) beg) 621 (setq pt (point))) 615 (or pt (setq pt (point))) 622 616 (looking-at PC-delim-regex)) 623 617 (setq skip (concat skip … … 666 660 (with-output-to-temp-buffer "*Completions*" 667 661 (display-completion-list (sort helpposs 'string-lessp)) 668 (save-excursion 669 (set-buffer standard-output) 662 (with-current-buffer standard-output 670 663 ;; Record which part of the buffer we are completing 671 664 ;; so that choosing a completion from the list … … 733 726 (interactive) 734 727 (let* ((end (point)) 735 (buffer-syntax (syntax-table)) 736 (beg (unwind-protect 737 (save-excursion 738 (if lisp-mode-syntax-table 739 (set-syntax-table lisp-mode-syntax-table)) 740 (backward-sexp 1) 741 (while (= (char-syntax (following-char)) ?\') 742 (forward-char 1)) 743 (point)) 744 (set-syntax-table buffer-syntax))) 728 (beg (save-excursion 729 (with-syntax-table lisp-mode-syntax-table 730 (backward-sexp 1) 731 (while (= (char-syntax (following-char)) ?\') 732 (forward-char 1)) 733 (point)))) 745 734 (minibuffer-completion-table obarray) 746 735 (minibuffer-completion-predicate … … 768 757 (PC-do-completion nil beg end))) 769 758 770 ;; ;Use the shell to do globbing.771 ;; ;This could now use file-expand-wildcards instead.759 ;; Use the shell to do globbing. 760 ;; This could now use file-expand-wildcards instead. 772 761 773 762 (defun PC-expand-many-files (name) 774 (save-excursion 775 (set-buffer (generate-new-buffer " *Glob Output*")) 763 (with-current-buffer (generate-new-buffer " *Glob Output*") 776 764 (erase-buffer) 777 765 (shell-command (concat "echo " name) t) … … 805 793 p)))) 806 794 807 ;; ;Facilities for loading C header files. This is independent from the808 ;; ;main completion code. See also the variable `PC-include-file-path'809 ;; ;at top of this file.795 ;; Facilities for loading C header files. This is independent from the 796 ;; main completion code. See also the variable `PC-include-file-path' 797 ;; at top of this file. 810 798 811 799 (defun PC-look-for-include-file () … … 818 806 (kill-buffer (current-buffer)) 819 807 (if (equal name "") 820 (save-excursion 821 (set-buffer (car (buffer-list))) 808 (with-current-buffer (car (buffer-list)) 822 809 (save-excursion 823 810 (beginning-of-line) … … 856 843 (setq name (concat (file-name-as-directory (car path)) name)) 857 844 (error "No such include file: <%s>" name))) 858 (let ((dir (save-excursion 859 (set-buffer (car (buffer-list))) 845 (let ((dir (with-current-buffer (car (buffer-list)) 860 846 default-directory))) 861 847 (if (file-exists-p (concat dir name)) … … 866 852 ;; no need to verify last-modified time for this! 867 853 (set-buffer new-buf) 868 (setq new-buf (create-file-buffer name)) 869 (set-buffer new-buf) 854 (set-buffer (create-file-buffer name)) 870 855 (erase-buffer) 871 856 (insert-file-contents name t)) … … 886 871 path))) 887 872 888 ;; ;This is adapted from lib-complete.el, by Mike Williams.873 ;; This is adapted from lib-complete.el, by Mike Williams. 889 874 (defun PC-include-file-all-completions (file search-path &optional full) 890 875 "Return all completions for FILE in any directory on SEARCH-PATH.
