From 806f0cc7302bd1dacfad8366f67a97e9bfbc8fc9 Mon Sep 17 00:00:00 2001 From: Leo Liu Date: Mon, 27 Aug 2012 20:33:05 +0800 Subject: [PATCH] Fix broken completion in sh-mode See: http://debbugs.gnu.org/12220 --- lisp/ChangeLog | 3 +++ lisp/progmodes/sh-script.el | 27 +++++++++------------------ 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 456eca53a8..4ef437213a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2012-08-27 Leo Liu + * progmodes/sh-script.el (sh-dynamic-complete-functions): Adapt to + completion-at-point. (Bug#12220) + * skeleton.el (skeleton-untabify): Change to nil (bug#12223). * progmodes/sh-script.el (sh-indent-comment): Change to t (bug#12267). diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index 90f9ce3a52..2d0cdeaeea 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -202,6 +202,11 @@ (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 @@ This is buffer-local in every such buffer.") (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 @@ This is buffer-local in every such buffer.") "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) @@ -1490,6 +1494,7 @@ with your script for an edit-interpret-debug cycle." (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) @@ -3682,20 +3687,6 @@ The document is bounded by `sh-here-document-word'." ;; 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) -- 2.20.1