emacs-devel
[Top][All Lists]
Advanced

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

Re: Feature request : Tab-completion for 'shell-comand'


From: Juri Linkov
Subject: Re: Feature request : Tab-completion for 'shell-comand'
Date: Wed, 05 Mar 2008 01:17:22 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (x86_64-unknown-linux-gnu)

>> M-x shell-command, as well as its relatives (shell-command-on-region,
>> grep, grep-find, compile and maybe more), do not provide any kind of
>> completion in the minibuffer. This is a surprising behaviour, because
>> almost any other interactive function prompting for something that can
>> be tab-completed do provide tab-completion.
>> TSUCHIYA Masatoshi wrote an enhancement for it, that can be found
>> http://namazu.org/~tsuchiya/elisp/shell-command.el . This code works
>> against current head.
>
> It's a neat package. However, its implementation is based mainly on
> defadvices of shell-command, shell-command-on-region, grep, grep-find
> and compile. I don't believe that it shall be integrated into the Emacs
> core lisp *this* way. This could be a conflict, because the author seems
> to be interested in offering this package for different Emacs version,
> where this approach looks necessary.

This is a useful feature to add to Emacs, and it is a pity it uses defadvices.
Perhaps defadvices could be replaced by a new shell-command specific
minibuffer keymap that just redefines TAB to perform completion on commands
and file names.  What I mean basically is:

(define-key shell-command-minibuffer-local-map "\t"
  (lambda ()
    (interactive)
    (require 'shell)
    (let ((comint-dynamic-complete-functions
           shell-dynamic-complete-functions))
      (comint-dynamic-complete))))

and use this map for reading commands in shell-command,
shell-command-on-region, grep, grep-find and compile.

-- 
Juri Linkov
http://www.jurta.org/emacs/




reply via email to

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