Commit fdadeb49 authored by Jarek Czekalski's avatar Jarek Czekalski
Browse files

Shell completion for filenames from current directory, related docs.

	* lisp/shell.el  Shell completion now matches executable filenames from
	the current buffer's directory, on systems in which this behaviour
	is the default (windows-nt, ms-dos).
	* src/callproc.c (Vexec_path): Document that exec-directory is in it.
	* doc/emacs/mini.texi (Completion Options): Add a link to Shell Options.
	* doc/emacs/misc.texi (Shell Mode): Move documentation of
	shell-completion-fignore from Shell Mode to Shell Options.

Fixes: debbugs:15461
parent b1797e3e
2013-12-27 Jarek Czekalski <jarekczek@poczta.onet.pl>
* mini.texi (Completion Options): Add a link to Shell Options.
* misc.texi (Shell Mode): Move documentation of
shell-completion-fignore from Shell Mode to Shell Options.
2013-12-26 João Távora <joaotavora@gmail.com>
* emacs.texi (Matching): Describe new features of Electric Pair
mode.
......
......@@ -550,6 +550,9 @@ previous example, @samp{foo.e} completes to @samp{foo.elc}. Emacs
disregards @code{completion-ignored-extensions} when showing
completion alternatives in the completion list.
Shell completion is an extended version of filename completion,
@pxref{Shell Options}.
@vindex completion-auto-help
If @code{completion-auto-help} is set to @code{nil}, the completion
commands never display the completion list buffer; you must type
......
......@@ -677,20 +677,13 @@ in the shell buffer to submit the current line as input.
@item @key{TAB}
@kindex TAB @r{(Shell mode)}
@findex completion-at-point
@cindex shell completion
Complete the command name or file name before point in the shell
buffer (@code{completion-at-point}). This uses the usual Emacs
completion rules (@pxref{Completion}), with the completion
alternatives being file names, environment variable names, the shell
command history, and history references (@pxref{History References}).
@vindex shell-completion-fignore
@vindex comint-completion-fignore
The variable @code{shell-completion-fignore} specifies a list of file
name extensions to ignore in Shell mode completion. The default
setting is @code{nil}, but some users prefer @code{("~" "#" "%")} to
ignore file names ending in @samp{~}, @samp{#} or @samp{%}. Other
related Comint modes use the variable @code{comint-completion-fignore}
instead.
For options controlling the completion, @pxref{Shell Options}.
@item M-?
@kindex M-? @r{(Shell mode)}
......@@ -1179,6 +1172,20 @@ the possible completions whenever completion is not exact.
If you set @code{shell-completion-execonly} to @code{nil},
it considers nonexecutable files as well.
@vindex shell-completion-fignore
@vindex comint-completion-fignore
The variable @code{shell-completion-fignore} specifies a list of file
name extensions to ignore in Shell mode completion. The default
setting is @code{nil}, but some users prefer @code{("~" "#" "%")} to
ignore file names ending in @samp{~}, @samp{#} or @samp{%}. Other
related Comint modes use the variable @code{comint-completion-fignore}
instead.
@findex shell-dynamic-complete-command
Some implementation details of the shell command completion may also be found
in the lisp documentation of the @code{shell-dynamic-complete-command}
function.
@findex shell-pushd-tohome
@findex shell-pushd-dextract
@findex shell-pushd-dunique
......
2013-12-27 Jarek Czekalski <jarekczek@poczta.onet.pl>
* shell.el Shell completion now matches executable filenames from
the current buffer's directory, on systems in which this behaviour
is the default (windows-nt, ms-dos).
2013-12-27 Glenn Morris <rgm@gnu.org>
* emacs-lisp/lisp-mode.el (lisp-mode-variables): Unbreak bootstrap.
......
......@@ -1108,12 +1108,13 @@ See `shell-command-regexp'."
(defun shell-dynamic-complete-command ()
"Dynamically complete the command at point.
This function is similar to `comint-dynamic-complete-filename', except that it
searches `exec-path' (minus the trailing Emacs library path) for completion
searches `exec-path' (minus trailing `exec-directory') for completion
candidates. Note that this may not be the same as the shell's idea of the
path.
Completion is dependent on the value of `shell-completion-execonly', plus
those that effect file completion.
Completion is dependent on the value of `shell-completion-execonly',
`shell-completion-fignore', plus those that affect file completion. See Info
node `Shell Options'.
Returns t if successful."
(interactive)
......@@ -1138,7 +1139,9 @@ Returns t if successful."
(start (if (zerop (length filename)) (point) (match-beginning 0)))
(end (if (zerop (length filename)) (point) (match-end 0)))
(filenondir (file-name-nondirectory filename))
(path-dirs (cdr (reverse exec-path))) ;FIXME: Why `cdr'?
; why cdr? see `shell-dynamic-complete-command'
(path-dirs (append (cdr (reverse exec-path))
(if (memq system-type '(windows-nt ms-dos)) '("."))))
(cwd (file-name-as-directory (expand-file-name default-directory)))
(ignored-extensions
(and comint-completion-fignore
......
2013-12-27 Jarek Czekalski <jarekczek@poczta.onet.pl>
* callproc.c (Vexec_path): Document that exec-directory is in it.
2013-12-27 Steve Purcell <steve@sanityinc.com> (tiny change)
* nsterm.m (syms_of_nsterm): Enable ns-use-srgb-colorspace by
......
......@@ -1686,7 +1686,11 @@ default if SHELL is not set. */);
DEFVAR_LISP ("exec-path", Vexec_path,
doc: /* List of directories to search programs to run in subprocesses.
Each element is a string (directory name) or nil (try default directory). */);
Each element is a string (directory name) or nil (try default directory).
By default the last element of this list is `exec-directory'. The
last element is not always used, for example in shell completion
(`shell-dynamic-complete-command'). */);
DEFVAR_LISP ("exec-suffixes", Vexec_suffixes,
doc: /* List of suffixes to try to find executable file names.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment