;;; pcomplete.el --- programmable completion
-;; Copyright (C) 1999, 2000,01,02,03,04 Free Sofware Foundation
+;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004
+;; 2005 Free Sofware Foundation, Inc.
;; Author: John Wiegley <johnw@gnu.org>
;; Keywords: processes abbrev
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
;;; Commentary:
:type 'boolean
:group 'pcomplete)
-(defcustom pcomplete-suffix-list (list directory-sep-char ?:)
+(defcustom pcomplete-suffix-list (list ?/ ?:)
"*A list of characters which constitute a proper suffix."
:type '(repeat character)
:group 'pcomplete)
;;; User Functions:
;;;###autoload
-(defun pcomplete ()
+(defun pcomplete (&optional interactively)
"Support extensible programmable completion.
To use this function, just bind the TAB key to it, or add it to your
completion functions list (it should occur fairly early in the list)."
- (interactive)
- (if (and (interactive-p)
+ (interactive "p")
+ (if (and interactively
pcomplete-cycle-completions
pcomplete-current-completions
(memq last-command '(pcomplete
(function
(lambda (file)
(if (eq (aref file (1- (length file)))
- directory-sep-char)
+ ?/)
(and pcomplete-dir-ignore
(string-match pcomplete-dir-ignore file))
(and pcomplete-file-ignore
;; since . is earlier in the ASCII alphabet than
;; /
(let ((left (if (eq (aref l (1- (length l)))
- directory-sep-char)
+ ?/)
(substring l 0 (1- (length l)))
l))
(right (if (eq (aref r (1- (length r)))
- directory-sep-char)
+ ?/)
(substring r 0 (1- (length r)))
r)))
(if above-cutoff
(unless (fboundp 'event-matches-key-specifier-p)
(defalias 'event-matches-key-specifier-p 'eq))
-(unless (fboundp 'read-event)
- (defsubst read-event (&optional prompt)
+(if (fboundp 'read-event)
+ (defsubst pcomplete-read-event (&optional prompt)
+ (read-event prompt))
+ (defsubst pcomplete-read-event (&optional prompt)
(aref (read-key-sequence prompt) 0)))
(unless (fboundp 'event-basic-type)
(prog1
(catch 'done
(while (with-current-buffer (get-buffer "*Completions*")
- (setq event (read-event)))
+ (setq event (pcomplete-read-event)))
(cond
((event-matches-key-specifier-p event ? )
(set-window-configuration pcomplete-last-window-config)