bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#12220: 24.2; [PATCH] completion completely broken in sh-script


From: Leo
Subject: bug#12220: 24.2; [PATCH] completion completely broken in sh-script
Date: Sat, 18 Aug 2012 03:31:18 +0800

As suggested by the subject. The bug is caused by blindly aliasing
comint-dynamic-complete to completion-at-point.

>From a986b6d40ccd76e7576cf4de678372c5bdd1713d Mon Sep 17 00:00:00 2001
From: Leo Liu <address@hidden>
Date: Sat, 18 Aug 2012 02:48:15 +0800
Subject: [PATCH] Fix broken completion in sh-script

---
 lisp/progmodes/sh-script.el |   27 +++++++++------------------
 1 file changed, 9 insertions(+), 18 deletions(-)

diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index 7d38df6a..f0dec93f 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -202,6 +202,11 @@ (eval-when-compile
   (require 'comint))
 (require 'executable)
 
+(autoload 'comint-completion-at-point "comint")
+(autoload 'comint-filename-completion "comint")
+(autoload 'shell-command-completion "shell")
+(autoload 'shell-environment-variable-completion "shell")
+
 (defvar font-lock-comment-face)
 (defvar font-lock-set-defaults)
 (defvar font-lock-string-face)
@@ -469,7 +474,6 @@ (defvar sh-mode-map
     (define-key map "`" 'skeleton-pair-insert-maybe)
     (define-key map "\"" 'skeleton-pair-insert-maybe)
 
-    (define-key map [remap complete-tag] 'comint-dynamic-complete)
     (define-key map [remap delete-backward-char]
       'backward-delete-char-untabify)
     (define-key map "\C-c:" 'sh-set-shell)
@@ -556,9 +560,9 @@ (defvar sh-skeleton-pair-default-alist '((?( _ ?)) (?\))
   "Value to use for `skeleton-pair-default-alist' in Shell-Script mode.")
 
 (defcustom sh-dynamic-complete-functions
-  '(shell-dynamic-complete-environment-variable
-    shell-dynamic-complete-command
-    comint-dynamic-complete-filename)
+  '(shell-environment-variable-completion
+    shell-command-completion
+    comint-filename-completion)
   "Functions for doing TAB dynamic completion."
   :type '(repeat function)
   :group 'sh-script)
@@ -1489,6 +1493,7 @@ (define-derived-mode sh-mode prog-mode "Shell-script"
   (set (make-local-variable 'local-abbrev-table) sh-mode-abbrev-table)
   (set (make-local-variable 'comint-dynamic-complete-functions)
        sh-dynamic-complete-functions)
+  (add-hook 'completion-at-point-functions 'comint-completion-at-point nil t)
   ;; we can't look if previous line ended with `\'
   (set (make-local-variable 'comint-prompt-regexp) "^[ \t]*")
   (set (make-local-variable 'imenu-case-fold-search) nil)
@@ -3681,20 +3686,6 @@ (defun sh-maybe-here-document (arg)
 
 ;; various other commands
 
-(autoload 'comint-dynamic-complete "comint"
-  "Dynamically perform completion at point." t)
-
-(autoload 'shell-dynamic-complete-command "shell"
-  "Dynamically complete the command at point." t)
-
-(autoload 'comint-dynamic-complete-filename "comint"
-  "Dynamically complete the filename at point." t)
-
-(autoload 'shell-dynamic-complete-environment-variable "shell"
-  "Dynamically complete the environment variable at point." t)
-
-
-
 (defun sh-beginning-of-command ()
   "Move point to successive beginnings of commands."
   (interactive)
-- 
1.7.9.6 (Apple Git-31.1)


reply via email to

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