aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2006-03-06 20:09:17 +0000
committerStefan Monnier2006-03-06 20:09:17 +0000
commit95983b950a75b69cc6b70cd5be70808747718cc8 (patch)
tree7f2ff954f938d92a0361c76c9884d22687360449
parent45a9517bae551d6afb60d16d23aeb80eb418ce8a (diff)
downloademacs-95983b950a75b69cc6b70cd5be70808747718cc8.tar.gz
emacs-95983b950a75b69cc6b70cd5be70808747718cc8.zip
(PC-expand-many-files): Try be more careful when parsing the shell's output.
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/complete.el27
2 files changed, 25 insertions, 7 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index c972a0d694d..8b3dba4f4cd 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12006-03-06 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * complete.el (PC-expand-many-files): Try be more careful when parsing
4 the shell's output.
5
12006-03-05 Stefan Monnier <monnier@iro.umontreal.ca> 62006-03-05 Stefan Monnier <monnier@iro.umontreal.ca>
2 7
3 * outline.el (hide-sublevels): Provide better interactive default. 8 * outline.el (hide-sublevels): Provide better interactive default.
diff --git a/lisp/complete.el b/lisp/complete.el
index a48942d2df1..a50d02c41f0 100644
--- a/lisp/complete.el
+++ b/lisp/complete.el
@@ -94,7 +94,7 @@
94 :group 'convenience) 94 :group 'convenience)
95 95
96(defcustom PC-first-char 'find-file 96(defcustom PC-first-char 'find-file
97 "*Control how the first character of a string is to be interpreted. 97 "Control how the first character of a string is to be interpreted.
98If nil, the first character of a string is not taken literally if it is a word 98If nil, the first character of a string is not taken literally if it is a word
99delimiter, so that \".e\" matches \"*.e*\". 99delimiter, so that \".e\" matches \"*.e*\".
100If t, the first character of a string is always taken literally even if it is a 100If t, the first character of a string is always taken literally even if it is a
@@ -107,13 +107,13 @@ completion."
107 :group 'partial-completion) 107 :group 'partial-completion)
108 108
109(defcustom PC-meta-flag t 109(defcustom PC-meta-flag t
110 "*If non-nil, TAB means PC completion and M-TAB means normal completion. 110 "If non-nil, TAB means PC completion and M-TAB means normal completion.
111Otherwise, TAB means normal completion and M-TAB means Partial Completion." 111Otherwise, TAB means normal completion and M-TAB means Partial Completion."
112 :type 'boolean 112 :type 'boolean
113 :group 'partial-completion) 113 :group 'partial-completion)
114 114
115(defcustom PC-word-delimiters "-_. " 115(defcustom PC-word-delimiters "-_. "
116 "*A string of characters treated as word delimiters for completion. 116 "A string of characters treated as word delimiters for completion.
117Some arcane rules: 117Some arcane rules:
118If `]' is in this string, it must come first. 118If `]' is in this string, it must come first.
119If `^' is in this string, it must not come first. 119If `^' is in this string, it must not come first.
@@ -124,13 +124,13 @@ expression (not containing character ranges like `a-z')."
124 :group 'partial-completion) 124 :group 'partial-completion)
125 125
126(defcustom PC-include-file-path '("/usr/include" "/usr/local/include") 126(defcustom PC-include-file-path '("/usr/include" "/usr/local/include")
127 "*A list of directories in which to look for include files. 127 "A list of directories in which to look for include files.
128If nil, means use the colon-separated path in the variable $INCPATH instead." 128If nil, means use the colon-separated path in the variable $INCPATH instead."
129 :type '(repeat directory) 129 :type '(repeat directory)
130 :group 'partial-completion) 130 :group 'partial-completion)
131 131
132(defcustom PC-disable-includes nil 132(defcustom PC-disable-includes nil
133 "*If non-nil, include-file support in \\[find-file] is disabled." 133 "If non-nil, include-file support in \\[find-file] is disabled."
134 :type 'boolean 134 :type 'boolean
135 :group 'partial-completion) 135 :group 'partial-completion)
136 136
@@ -764,7 +764,13 @@ or properties are considered."
764 (erase-buffer) 764 (erase-buffer)
765 (shell-command (concat "echo " name) t) 765 (shell-command (concat "echo " name) t)
766 (goto-char (point-min)) 766 (goto-char (point-min))
767 (if (looking-at ".*No match") 767 ;; CSH-style shells were known to output "No match", whereas
768 ;; SH-style shells tend to simply output `name' when no match is found.
769 (if (looking-at (concat ".*No match\\|\\(^\\| \\)\\("
770 (regexp-quote name)
771 "\\|"
772 (regexp-quote (expand-file-name name))
773 "\\)\\( \\|$\\)"))
768 nil 774 nil
769 (insert "(\"") 775 (insert "(\"")
770 (while (search-forward " " nil t) 776 (while (search-forward " " nil t)
@@ -787,7 +793,14 @@ or properties are considered."
787 "\\)\\'"))) 793 "\\)\\'")))
788 (setq p nil) 794 (setq p nil)
789 (while files 795 (while files
790 (or (string-match PC-ignored-regexp (car files)) 796 ;; This whole process of going through to shell, to echo, and
797 ;; finally parsing the output is a hack. It breaks as soon as
798 ;; there are spaces in the file names or when the no-match
799 ;; message changes. To make up for it, we check that what we read
800 ;; indeed exists, so we may miss some files, but we at least won't
801 ;; list non-existent ones.
802 (or (not (file-exists-p (car files)))
803 (string-match PC-ignored-regexp (car files))
791 (setq p (cons (car files) p))) 804 (setq p (cons (car files) p)))
792 (setq files (cdr files))) 805 (setq files (cdr files)))
793 p)))) 806 p))))