Skip to content

Commit 51c7770

Browse files
authored
Fix and update README.md
This change fixes some incorrect quotes, using emacs-style `' instead of makdown-style ``. It rewords the instructions for using bash-completion-dynamic-complete-nocomint
1 parent e24a596 commit 51c7770

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

README.md

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Bash completion for Emacs:
1414
- works on remote shells, through TRAMP.
1515

1616
A simpler and more complete alternative to bash-completion.el is to
17-
run a bash shell in a buffer in term mode(M-x `ansi-term').
17+
run a bash shell in a buffer in term mode (`M-x ansi-term`).
1818
Unfortunately, many Emacs editing features are not available when
1919
running in term mode. Also, term mode is not available in
2020
shell-command prompts.
@@ -49,7 +49,7 @@ or simpler, but forces you to load bash-completion at startup:
4949
(bash-completion-setup)
5050
```
5151

52-
After that reload your .emacs (M-x `eval-buffer') or restart.
52+
After that reload your .emacs (`M-x eval-buffer`) or restart.
5353

5454
When called from a bash shell buffer,
5555
`bash-completion-dynamic-complete` communicates with the current shell
@@ -65,20 +65,25 @@ from normal shell processes.
6565
### Completion at point
6666

6767
Additionally, you can enable bash completion in any buffer that contains bash
68-
commands. To do that, call `bash-completion-dynamic-complete-nocomint` from a
69-
function added to `completion-at-point-functions`.
68+
commands. To do that, call
69+
```elisp
70+
(bash-completion-dynamic-complete-nocomint COMP-START COMP-POS DYNAMIC-TABLE)
71+
```
72+
from a function added to `completion-at-point-functions`.
7073

71-
The tricky part is figuring out where the bash command starts, because that
72-
depends on the mode of the calling buffer and might, in some cases, span
74+
The trickiest part is setting COMP-START to where the bash command starts;
75+
It depends on the mode of the calling buffer and might, in some cases, span
7376
multiple lines.
7477

75-
In any cases, when calling from `completion-at-point', make sure to pass a
76-
non-nil value to DYNAMIC-TABLE argument. This isn't just an optimization:
77-
returning a function instead of a list tells Emacs it should avoids
78-
post-filtering the results and possibly discarding useful completion from
79-
bash.
78+
COMP-POS is usually the current position of the cursor.
79+
80+
When calling from `completion-at-point`, make sure to pass a non-nil value
81+
to the DYNAMIC-TABLE argument so it returns a function instead of a list
82+
of strings. This isn't just an optimization: returning a function instead
83+
of a list tells Emacs it should avoids post-filtering the results and
84+
possibly discarding useful completion from bash.
8085

81-
Here's, for example, a function to to do bash completion from an
86+
For example, here's a function to to do bash completion from an
8287
eshell buffer. To try it out, add the function below to your init file
8388
and bind `bash-completion-from-eshell` to a custom shortcut.
8489

0 commit comments

Comments
 (0)