Subject: bug#19911: 24.4; shell-mode command completion - smarter handling of backup files

From: Eli Zaretskii <[email-masked]>
Date: Fri, 20 Feb 2015 13:43:11 +0200

> From: Ed Avis <[email-masked]>
> Date: Fri, 20 Feb 2015 11:35:21 +0000
> 
> Create a file 'script' and make it executable.  Edit it in emacs
> so that a backup file 'script~' is also created (and Emacs makes
> the backup file executable too).
> 
> Now m-x shell and type
> 
>    ls script TAB TAB
> 
> The first TAB appears not to do anything, but the second TAB inserts a
> space as a unique completion.  This is because tab-completion for
> filenames gives lower importance to backup files ending ~, so that they
> won't by themselves cause a completions buffer to pop up.  That is a
> useful enhancement to the usability of tab-completion.
> 
> However, the same useful behaviour isn't applied for command completion,
> in other words the first word of the shell command typed.  Enter
> 
>    ./script TAB TAB
> 
> and you get a 'Complete, but not unique' message and on the second TAB
> a completions buffer showing script and script~.
> 
> It would be more useful to treat the backup file consistently with what
> happens for ordinary filename completion, so that the first TAB would
> appear to do nothing, while the second TAB inserts a space.

Does customizing shell-completion-fignore to include "~" do what you
want?