* progmodes/octave-mod.el (inferior-octave-send-list-and-digest):
[bpt/emacs.git] / lisp / pcomplete.el
index 86d9301..8116ad9 100644 (file)
@@ -10,7 +10,7 @@
 
 ;; GNU Emacs is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
+;; the Free Software Foundation; either version 3, or (at your option)
 ;; any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
@@ -281,6 +281,10 @@ to all arguments, such as variable names after a $."
   :type 'hook
   :group 'pcomplete)
 
+(defsubst pcomplete-executables (&optional regexp)
+  "Complete amongst a list of directories and executables."
+  (pcomplete-entries regexp 'file-executable-p))
+
 (defcustom pcomplete-command-completion-function
   (function
    (lambda ()
@@ -599,6 +603,8 @@ this is `comint-dynamic-complete-functions'."
   "Setup shell-mode to use pcomplete."
   (pcomplete-comint-setup 'shell-dynamic-complete-functions))
 
+(declare-function comint-bol "comint" (&optional arg))
+
 (defun pcomplete-parse-comint-arguments ()
   "Parse whitespace separated arguments in the current region."
   (let ((begin (save-excursion (comint-bol nil) (point)))
@@ -780,10 +786,6 @@ component, `default-directory' is used as the basis for completion."
   "Complete amongst a list of directories."
   (pcomplete-entries regexp 'file-directory-p))
 
-(defsubst pcomplete-executables (&optional regexp)
-  "Complete amongst a list of directories and executables."
-  (pcomplete-entries regexp 'file-executable-p))
-
 ;; generation of completion lists
 
 (defun pcomplete-find-completion-function (command)
@@ -944,17 +946,16 @@ generate the completions list.  This means that the hook
 ;; Abstractions so that the code below will work for both Emacs 20 and
 ;; XEmacs 21
 
-(unless (fboundp 'event-matches-key-specifier-p)
-  (defalias 'event-matches-key-specifier-p 'eq))
+(defalias 'pcomplete-event-matches-key-specifier-p
+  (if (featurep 'xemacs)
+      'event-matches-key-specifier-p
+  'eq))
 
 (defun pcomplete-read-event (&optional prompt)
   (if (fboundp 'read-event)
       (read-event prompt)
     (aref (read-key-sequence prompt) 0)))
 
-(unless (fboundp 'event-basic-type)
-  (defalias 'event-basic-type 'event-key))
-
 (defun pcomplete-show-completions (completions)
   "List in help buffer sorted COMPLETIONS.
 Typing SPC flushes the help buffer."
@@ -973,13 +974,13 @@ Typing SPC flushes the help buffer."
            (while (with-current-buffer (get-buffer "*Completions*")
                     (setq event (pcomplete-read-event)))
              (cond
-              ((event-matches-key-specifier-p event ?\s)
+              ((pcomplete-event-matches-key-specifier-p event ?\s)
                (set-window-configuration pcomplete-last-window-config)
                (setq pcomplete-last-window-config nil)
                (throw 'done nil))
-              ((or (event-matches-key-specifier-p event 'tab)
+              ((or (pcomplete-event-matches-key-specifier-p event 'tab)
                     ;; Needed on a terminal
-                    (event-matches-key-specifier-p event 9))
+                    (pcomplete-event-matches-key-specifier-p event 9))
                 (let ((win (or (get-buffer-window "*Completions*" 0)
                                (display-buffer "*Completions*"
                                                'not-this-window))))