diff options
| author | Karl Heuer | 1999-04-26 04:59:46 +0000 |
|---|---|---|
| committer | Karl Heuer | 1999-04-26 04:59:46 +0000 |
| commit | 5b0f8cbcbda0d0e4c6ea659e1b48da29394f356b (patch) | |
| tree | 154153acfd8052ea6294b9131f97b460a3f6eb64 | |
| parent | ac6b7d78589abd2551131431a95e6532a710aab5 (diff) | |
| download | emacs-5b0f8cbcbda0d0e4c6ea659e1b48da29394f356b.tar.gz emacs-5b0f8cbcbda0d0e4c6ea659e1b48da29394f356b.zip | |
Delete the wildcard expansion feature
since that is now standard in find-file.
(PC-try-load-many-files): Function deleted.
(PC-after-load-many-files): Function deleted.
(PC-many-files-list): Variable deleted.
(PC-disable-wildcards): Variable deleted.
(partial-completion-mode): Don't enable the wildcard feature.
(PC-look-for-include-file): Don't set global variables
`error', `buf' and `filename' here.
| -rw-r--r-- | lisp/complete.el | 85 |
1 files changed, 6 insertions, 79 deletions
diff --git a/lisp/complete.el b/lisp/complete.el index 6afdb66521c..6b5cc3d5900 100644 --- a/lisp/complete.el +++ b/lisp/complete.el | |||
| @@ -1,10 +1,9 @@ | |||
| 1 | ;;; complete.el --- partial completion mechanism plus other goodies | 1 | ;;; complete.el --- partial completion mechanism plus other goodies |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1990, 1991, 1992, 1993 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1990, 1991, 1992, 1993, 1999 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Dave Gillespie <daveg@synaptics.com> | 5 | ;; Author: Dave Gillespie <daveg@synaptics.com> |
| 6 | ;; Keywords: abbrev convenience | 6 | ;; Keywords: abbrev convenience |
| 7 | ;; Version: 2.03 | ||
| 8 | ;; Special thanks to Hallvard Furuseth for his many ideas and contributions. | 7 | ;; Special thanks to Hallvard Furuseth for his many ideas and contributions. |
| 9 | 8 | ||
| 10 | ;; This file is part of GNU Emacs. | 9 | ;; This file is part of GNU Emacs. |
| @@ -78,12 +77,6 @@ | |||
| 78 | ;; The regular M-TAB (lisp-complete-symbol) command also supports | 77 | ;; The regular M-TAB (lisp-complete-symbol) command also supports |
| 79 | ;; partial completion in this package. | 78 | ;; partial completion in this package. |
| 80 | 79 | ||
| 81 | ;; This package also contains a wildcard feature for C-x C-f (find-file). | ||
| 82 | ;; For example, `C-x C-f *.c RET' loads all .c files at once, exactly | ||
| 83 | ;; as if you had typed C-x C-f separately for each file. Completion | ||
| 84 | ;; is supported in connection with wildcards. Currently only the `*' | ||
| 85 | ;; wildcard character works. | ||
| 86 | |||
| 87 | ;; File name completion does not do partial completion of directories | 80 | ;; File name completion does not do partial completion of directories |
| 88 | ;; on the path, e.g., "/u/b/f" will not complete to "/usr/bin/foo", | 81 | ;; on the path, e.g., "/u/b/f" will not complete to "/usr/bin/foo", |
| 89 | ;; but you can put *'s in the path to accomplish this: "/u*/b*/f". | 82 | ;; but you can put *'s in the path to accomplish this: "/u*/b*/f". |
| @@ -155,11 +148,6 @@ If nil, means use the colon-separated path in the variable $INCPATH instead." | |||
| 155 | :type '(repeat directory) | 148 | :type '(repeat directory) |
| 156 | :group 'partial-completion) | 149 | :group 'partial-completion) |
| 157 | 150 | ||
| 158 | (defcustom PC-disable-wildcards nil | ||
| 159 | "*If non-nil, wildcard support in \\[find-file] is disabled." | ||
| 160 | :type 'boolean | ||
| 161 | :group 'partial-completion) | ||
| 162 | |||
| 163 | (defcustom PC-disable-includes nil | 151 | (defcustom PC-disable-includes nil |
| 164 | "*If non-nil, include-file support in \\[find-file] is disabled." | 152 | "*If non-nil, include-file support in \\[find-file] is disabled." |
| 165 | :type 'boolean | 153 | :type 'boolean |
| @@ -185,11 +173,6 @@ command begins with that sequence of characters, and | |||
| 185 | \\[find-file] f_b.c TAB might complete to foo_bar.c if that file existed and no | 173 | \\[find-file] f_b.c TAB might complete to foo_bar.c if that file existed and no |
| 186 | other file in that directory begin with that sequence of characters. | 174 | other file in that directory begin with that sequence of characters. |
| 187 | 175 | ||
| 188 | Unless `PC-disable-wildcards' is non-nil, the \"*\" wildcard is interpreted | ||
| 189 | specially when entering file or directory names. For example, | ||
| 190 | \\[find-file] *.c RET finds each C file in the current directory, and | ||
| 191 | \\[find-file] */foo_bar.c TAB completes the directory name as far as possible. | ||
| 192 | |||
| 193 | Unless `PC-disable-includes' is non-nil, the \"<...>\" sequence is interpreted | 176 | Unless `PC-disable-includes' is non-nil, the \"<...>\" sequence is interpreted |
| 194 | specially in \\[find-file]. For example, | 177 | specially in \\[find-file]. For example, |
| 195 | \\[find-file] <sys/time.h> RET finds the file /usr/include/sys/time.h. | 178 | \\[find-file] <sys/time.h> RET finds the file /usr/include/sys/time.h. |
| @@ -200,11 +183,6 @@ See also the variable `PC-include-file-path'." | |||
| 200 | (not partial-completion-mode)))) | 183 | (not partial-completion-mode)))) |
| 201 | ;; Deal with key bindings... | 184 | ;; Deal with key bindings... |
| 202 | (PC-bindings on-p) | 185 | (PC-bindings on-p) |
| 203 | ;; Deal with wildcard file feature... | ||
| 204 | (cond ((not on-p) | ||
| 205 | (remove-hook 'find-file-not-found-hooks 'PC-try-load-many-files)) | ||
| 206 | ((not PC-disable-wildcards) | ||
| 207 | (add-hook 'find-file-not-found-hooks 'PC-try-load-many-files))) | ||
| 208 | ;; Deal with include file feature... | 186 | ;; Deal with include file feature... |
| 209 | (cond ((not on-p) | 187 | (cond ((not on-p) |
| 210 | (remove-hook 'find-file-not-found-hooks 'PC-look-for-include-file)) | 188 | (remove-hook 'find-file-not-found-hooks 'PC-look-for-include-file)) |
| @@ -771,58 +749,8 @@ or properties are considered." | |||
| 771 | (PC-not-minibuffer t)) | 749 | (PC-not-minibuffer t)) |
| 772 | (PC-do-completion nil beg end))) | 750 | (PC-do-completion nil beg end))) |
| 773 | 751 | ||
| 774 | 752 | ;;; Use the shell to do globbing. | |
| 775 | ;;; Wildcards in `C-x C-f' command. This is independent from the main | 753 | ;;; This could now use file-expand-wildcards instead. |
| 776 | ;;; completion code, except for `PC-expand-many-files' which is called | ||
| 777 | ;;; when "*"'s are found in the path during filename completion. (The | ||
| 778 | ;;; above completion code always understands "*"'s, except in file paths, | ||
| 779 | ;;; without relying on the following code.) | ||
| 780 | |||
| 781 | (defvar PC-many-files-list nil) | ||
| 782 | |||
| 783 | (defun PC-try-load-many-files () | ||
| 784 | (if (string-match "\\*" buffer-file-name) | ||
| 785 | (let* ((pat buffer-file-name) | ||
| 786 | (files (PC-expand-many-files pat)) | ||
| 787 | (first (car files)) | ||
| 788 | (next (reverse (cdr files)))) | ||
| 789 | (kill-buffer (current-buffer)) | ||
| 790 | (or files | ||
| 791 | (error "No matching files")) | ||
| 792 | ;; Bring the other files (not the first) into buffers. | ||
| 793 | (save-window-excursion | ||
| 794 | (while next | ||
| 795 | (let ((buf (find-file-noselect (car next)))) | ||
| 796 | ;; Put this buffer at the front of the buffer list. | ||
| 797 | (switch-to-buffer buf)) | ||
| 798 | (setq next (cdr next)))) | ||
| 799 | ;; This modifies the `buf' variable inside find-file-noselect. | ||
| 800 | (setq buf (get-file-buffer first)) | ||
| 801 | (if buf | ||
| 802 | nil ; should do verify-visited-file-modtime stuff. | ||
| 803 | (setq filename first) | ||
| 804 | (setq buf (create-file-buffer filename)) | ||
| 805 | ;; This modified `truename' inside find-file-noselect. | ||
| 806 | (setq truename (abbreviate-file-name (file-truename filename))) | ||
| 807 | (set-buffer buf) | ||
| 808 | (erase-buffer) | ||
| 809 | (insert-file-contents filename t)) | ||
| 810 | (if (cdr files) | ||
| 811 | (setq PC-many-files-list (mapconcat | ||
| 812 | (if (string-match "\\*.*/" pat) | ||
| 813 | 'identity | ||
| 814 | 'file-name-nondirectory) | ||
| 815 | (cdr files) ", ") | ||
| 816 | find-file-hooks (cons 'PC-after-load-many-files | ||
| 817 | find-file-hooks))) | ||
| 818 | ;; This modifies the "error" variable inside find-file-noselect. | ||
| 819 | (setq error nil) | ||
| 820 | t) | ||
| 821 | nil)) | ||
| 822 | |||
| 823 | (defun PC-after-load-many-files () | ||
| 824 | (setq find-file-hooks (delq 'PC-after-load-many-files find-file-hooks)) | ||
| 825 | (message "Also loaded %s." PC-many-files-list)) | ||
| 826 | 754 | ||
| 827 | (defun PC-expand-many-files (name) | 755 | (defun PC-expand-many-files (name) |
| 828 | (save-excursion | 756 | (save-excursion |
| @@ -914,7 +842,7 @@ or properties are considered." | |||
| 914 | default-directory))) | 842 | default-directory))) |
| 915 | (if (file-exists-p (concat dir name)) | 843 | (if (file-exists-p (concat dir name)) |
| 916 | (setq name (concat dir name)) | 844 | (setq name (concat dir name)) |
| 917 | (error "No such include file: \"%s\"" name)))) | 845 | (error "No such include file: `%s'" name)))) |
| 918 | (setq new-buf (get-file-buffer name)) | 846 | (setq new-buf (get-file-buffer name)) |
| 919 | (if new-buf | 847 | (if new-buf |
| 920 | ;; no need to verify last-modified time for this! | 848 | ;; no need to verify last-modified time for this! |
| @@ -923,9 +851,8 @@ or properties are considered." | |||
| 923 | (set-buffer new-buf) | 851 | (set-buffer new-buf) |
| 924 | (erase-buffer) | 852 | (erase-buffer) |
| 925 | (insert-file-contents name t)) | 853 | (insert-file-contents name t)) |
| 926 | (setq filename name | 854 | ;; Returning non-nil with the new buffer current |
| 927 | error nil | 855 | ;; is sufficient to tell find-file to use it. |
| 928 | buf new-buf) | ||
| 929 | t) | 856 | t) |
| 930 | nil)) | 857 | nil)) |
| 931 | 858 | ||