]> code.delx.au - gnu-emacs/blobdiff - lisp/pcomplete.el
(Abbrevs): A @node line without explicit Prev, Next, and Up links.
[gnu-emacs] / lisp / pcomplete.el
index f4b796dd1a769c3d10b8ac6bc4d38cc770a8b2db..0f970c5191a94e5b0d2feba0fdd4fc46fb78fbe8 100644 (file)
@@ -1,6 +1,7 @@
 ;;; pcomplete.el --- programmable completion
 
-;; Copyright (C) 1999, 2000,01,02,03,04 Free Sofware Foundation
+;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004
+;;   2005, 2006 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <johnw@gnu.org>
 ;; Keywords: processes abbrev
@@ -19,8 +20,8 @@
 
 ;; 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:
 
@@ -946,8 +947,10 @@ generate the completions list.  This means that the hook
 (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)
@@ -969,13 +972,15 @@ Typing SPC flushes the help buffer."
       (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)
                (setq pcomplete-last-window-config nil)
                (throw 'done nil))
-              ((event-matches-key-specifier-p event 'tab)
+              ((or (event-matches-key-specifier-p event 'tab)
+                    ;; Needed on a terminal
+                    (event-matches-key-specifier-p event 9))
                (save-selected-window
                  (select-window (get-buffer-window "*Completions*"))
                  (if (pos-visible-in-window-p (point-max))
@@ -1135,7 +1140,7 @@ If specific documentation can't be given, be generic."
                    (fboundp 'Info-goto-node))
               (listp pcomplete-help)))
       (if (listp pcomplete-help)
-         (message (eval pcomplete-help))
+         (message "%s" (eval pcomplete-help))
        (save-window-excursion (info))
        (switch-to-buffer-other-window "*info*")
        (funcall (symbol-function 'Info-goto-node) pcomplete-help))