]> code.delx.au - gnu-emacs/blobdiff - lisp/eshell/em-cmpl.el
* lisp/eshell/em-cmpl.el: Corrected "context-related help"
[gnu-emacs] / lisp / eshell / em-cmpl.el
index a67861e83a9a8b847805536751087393562b1ee5..91311deffcffa3f8e65df4f6e3cefa58bad92867 100644 (file)
@@ -1,6 +1,6 @@
 ;;; em-cmpl.el --- completion using the TAB key
 
-;; Copyright (C) 1999-201 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2013 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <johnw@gnu.org>
 
@@ -63,7 +63,7 @@
 ;; The list of possible completions can be viewed at any point by
 ;; pressing <M-?>.
 ;;
-;; Finally, context-related help can be accessed by pressing <C-c i>.
+;; Finally, context-related help can be accessed by pressing <C-c M-h>.
 ;; This only works well if the completion function has provided Eshell
 ;; with sufficient pointers to locate the relevant help text.
 
@@ -295,8 +295,10 @@ to writing a completion function."
     'pcomplete-expand-and-complete)
   (define-key eshell-command-map [space] 'pcomplete-expand)
   (define-key eshell-command-map [? ] 'pcomplete-expand)
-  (define-key eshell-mode-map [tab] 'pcomplete)
-  (define-key eshell-mode-map [(control ?i)] 'pcomplete)
+  (define-key eshell-mode-map [tab] 'eshell-pcomplete)
+  (define-key eshell-mode-map [(control ?i)] 'eshell-pcomplete)
+  (add-hook 'completion-at-point-functions
+            #'pcomplete-completions-at-point nil t)
   ;; jww (1999-10-19): Will this work on anything but X?
   (if (featurep 'xemacs)
       (define-key eshell-mode-map [iso-left-tab] 'pcomplete-reverse)
@@ -449,6 +451,17 @@ to writing a completion function."
                        (all-completions filename obarray 'functionp))
                   completions)))))))
 
+(defun eshell-pcomplete (&optional interactively)
+  "Eshell wrapper for `pcomplete'."
+  (interactive "p")
+  ;; Pretend to be pcomplete so that cycling works (bug#13293).
+  (setq this-command 'pcomplete)
+  (condition-case nil
+      (if interactively
+         (call-interactively 'pcomplete)
+       (pcomplete))
+    (text-read-only (completion-at-point)))) ; Workaround for bug#12838.
+
 (provide 'em-cmpl)
 
 ;; Local Variables: