emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r106788: Proper fix for shell-complet


From: Chong Yidong
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r106788: Proper fix for shell-completion-execonly.
Date: Thu, 05 Jan 2012 22:51:05 +0800
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 106788
fixes bug(s): http://debbugs.gnu.org/10417
committer: Chong Yidong <address@hidden>
branch nick: trunk
timestamp: Thu 2012-01-05 22:51:05 +0800
message:
  Proper fix for shell-completion-execonly.
  
  * shell.el (shell-dynamic-complete-functions): Revert last change.
  (shell-command-completion-function): New function.
  (shell-completion-vars): Use it to implement
  shell-completion-execonly.
modified:
  lisp/ChangeLog
  lisp/shell.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-01-05 11:12:11 +0000
+++ b/lisp/ChangeLog    2012-01-05 14:51:05 +0000
@@ -1,5 +1,10 @@
 2012-01-05  Chong Yidong  <address@hidden>
 
+       * shell.el (shell-dynamic-complete-functions): Revert last change.
+       (shell-command-completion-function): New function.
+       (shell-completion-vars): Use it to implement
+       shell-completion-execonly (Bug#10417).
+
        * custom.el (enable-theme): Don't set custom-safe-themes.
 
        * cus-theme.el (custom-theme-merge-theme): Ignore

=== modified file 'lisp/shell.el'
--- a/lisp/shell.el     2012-01-05 09:46:05 +0000
+++ b/lisp/shell.el     2012-01-05 14:51:05 +0000
@@ -187,11 +187,9 @@
     shell-environment-variable-completion
     shell-command-completion
     shell-c-a-p-replace-by-expanded-directory
+    pcomplete-completions-at-point
     shell-filename-completion
-    comint-filename-completion
-    ;; This goes last, so that `comint-filename-completion' can handle
-    ;; `shell-completion-execonly' (Bug#10417).
-    pcomplete-completions-at-point)
+    comint-filename-completion)
   "List of functions called to perform completion.
 This variable is used to initialize `comint-dynamic-complete-functions' in the
 shell buffer.
@@ -407,6 +405,15 @@
           (push (mapconcat #'identity (nreverse arg) "") args)))
       (cons (nreverse args) (nreverse begins)))))
 
+(defun shell-command-completion-function ()
+  "Completion function for shell command names.
+This is the value of `pcomplete-command-completion-function' for
+Shell buffers.  It implements `shell-completion-execonly' for
+`pcomplete' completion."
+  (pcomplete-here (pcomplete-entries nil
+                                    (if shell-completion-execonly
+                                        'file-executable-p))))
+
 (defun shell-completion-vars ()
   "Setup completion vars for `shell-mode' and `read-shell-command'."
   (set (make-local-variable 'comint-completion-fignore)
@@ -428,6 +435,8 @@
               comint-completion-addsuffix)
              ((not (consp comint-completion-addsuffix)) " ")
              (t (cdr comint-completion-addsuffix))))
+  (set (make-local-variable 'pcomplete-command-completion-function)
+       #'shell-command-completion-function)
   ;; Don't use pcomplete's defaulting mechanism, rely on
   ;; shell-dynamic-complete-functions instead.
   (set (make-local-variable 'pcomplete-default-completion-function) #'ignore)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]