{"id":13862921,"url":"https://github.com/szermatt/emacs-bash-completion","last_synced_at":"2025-07-25T20:37:26.671Z","repository":{"id":38144541,"uuid":"1625684","full_name":"szermatt/emacs-bash-completion","owner":"szermatt","description":"Add programmable bash completion to Emacs shell-mode","archived":false,"fork":false,"pushed_at":"2025-07-20T12:34:38.000Z","size":552,"stargazers_count":289,"open_issues_count":8,"forks_count":33,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-07-20T14:31:19.090Z","etag":null,"topics":["bash","bash-completion","emacs","emacs-lisp"],"latest_commit_sha":null,"homepage":"","language":"Emacs Lisp","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/szermatt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2011-04-17T08:08:27.000Z","updated_at":"2025-07-20T12:34:42.000Z","dependencies_parsed_at":"2024-08-05T06:05:57.263Z","dependency_job_id":"5237d06f-7d32-4030-8ce3-24052a00a7cd","html_url":"https://github.com/szermatt/emacs-bash-completion","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/szermatt/emacs-bash-completion","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/szermatt%2Femacs-bash-completion","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/szermatt%2Femacs-bash-completion/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/szermatt%2Femacs-bash-completion/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/szermatt%2Femacs-bash-completion/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/szermatt","download_url":"https://codeload.github.com/szermatt/emacs-bash-completion/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/szermatt%2Femacs-bash-completion/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267057924,"owners_count":24028928,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-25T02:00:09.625Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bash","bash-completion","emacs","emacs-lisp"],"created_at":"2024-08-05T06:01:56.104Z","updated_at":"2025-07-25T20:37:26.614Z","avatar_url":"https://github.com/szermatt.png","language":"Emacs Lisp","readme":"# bash-completion for Emacs [![test](https://github.com/szermatt/emacs-bash-completion/workflows/test/badge.svg)](https://github.com/szermatt/emacs-bash-completion/actions) [![melpa](https://melpa.org/packages/bash-completion-badge.svg)](https://melpa.org/#/bash-completion) [![melpa-stable](https://stable.melpa.org/packages/bash-completion-badge.svg)](https://stable.melpa.org/#/bash-completion)\n\n\nbash-completion.el defines dynamic completion hooks for shell-mode\nand shell-command prompts that is based on bash completion.\n\nBash completion for Emacs:\n\n- is aware of bash builtins, aliases and functions\n- does file expansion inside of colon-separated variables\n  and after redirections (\u003e or \u003c)\n- escapes special characters when expanding file names\n- is configurable through programmable bash completion\n- works on remote shells, through TRAMP.\n\nHowever, bash-completion.el only works with bash. If you run\nother shells or other interactive programs that support completion,\nbash-completion will not be able to help.\n\nA more powerful alternative to bash-completion.el is [MisTTY],\nas it works with all shells and most interactive programs that support\ncompletion. On the other hand, MisTTY cannot integrate with Emacs\ncompletion and is not able to provide completion in shell-command\nprompts nor in eshell mode.\n\n\u003e [!NOTE]\n\u003e While I'm still maintaining bash-completion.el, I've switched\n\u003e to [MisTTY] for day-to-day operation, so that package is more\n\u003e likely to receive updates. -- szermatt\n\n[MisTTY]: http://github.com/szermatt/mistty\n\n## INSTALLATION\n\nCopy bash-completion.el into a directory that's on Emacs load-path.\nYou can do that manually, or by installing it from\n[MELPA](https://melpa.org/#/getting-started).\n\n### Shell completion\n\nTo enable bash completion in shell buffers as well as in command\nprompts, such as the prompt started by `compile`, add the hook\n`bash-completion-dynamic-complete` to\n`shell-dynamic-complete-functions`.\n\nFor example:\n\n```elisp\n        (autoload 'bash-completion-dynamic-complete\n          \"bash-completion\"\n          \"BASH completion hook\")\n        (add-hook 'shell-dynamic-complete-functions\n          'bash-completion-dynamic-complete)\n```\n\nor simpler, but forces you to load bash-completion at startup:\n\n```elisp\n        (require 'bash-completion)\n        (bash-completion-setup)\n```\n\nAfter that reload your .emacs (`M-x eval-buffer`) or restart.\n\nWhen called from a bash shell buffer,\n`bash-completion-dynamic-complete` communicates with the current shell\nto reproduce, as closely as possible the normal bash auto-completion,\navailable on full terminals.\n\nWhen called from non-shell buffers, such as the prompt of M-x compile,\n`bash-completion-dynamic-complete` creates a separate bash process\njust for doing completion. Such processes have the environment\nvariable `EMACS_BASH_COMPLETE` set to `t`, to help distinguish them\nfrom normal shell processes.\n\n### Completion at point\n\nYou can also use bash completion as an additional completion function\nin any buffer that contains bash commands. To do that, add\n`bash-completion-capf-nonexclusive` to the buffer-local\n`completion-at-point-functions`. For example, you can setup bash\ncompletion in `eshell-mode` by invoking\n\n```elisp\n(add-hook 'eshell-mode-hook\n          (lambda ()\n            (add-hook 'completion-at-point-functions\n                      'bash-completion-capf-nonexclusive nil t)))\n```\n\nThere is also a lower-level function\n`bash-completion-dynamic-complete-nocomint` which allows you to\nconstruct your own `completion-at-point` function.\n\n```elisp\n(bash-completion-dynamic-complete-nocomint COMP-START COMP-POS DYNAMIC-TABLE)\n```\n\nCOMP-START is where the bash command starts --- it depends on the mode\nof the calling buffer. In most cases, `line-beginning-position` works\nbecause it uses `field` boundaries.\n\nCOMP-POS is usually the current position of the cursor.\n\nWhen calling from `completion-at-point`, make sure to pass a non-nil\nvalue to the DYNAMIC-TABLE argument so it returns a function instead\nof a list of strings. This isn't just an optimization: returning a\nfunction instead of a list tells Emacs it should avoids post-filtering\nthe results and possibly discarding useful completion from bash.\n\n## TROUBLESHOOTING\n\nIf completion in a bash shell doesn't behave as you think it should, check\nthe following:\n\n* Does bash behave differently when run outside of Emacs? If not, check\n  your shell configuration.\n* Call `M-x bash-completion-debug` and look at the `output-buffer`\n  section. Does it  match the expected set of completion? If yes,\n  it might be a display problem. Are you using a completion engine\n  other than the default, such as ivy or helm? Try turning it off to\n  confirm, then [file a bug](\n    https://github.com/szermatt/emacs-bash-completion/issues/new).\n* If all else fails, [file a bug](\n  https://github.com/szermatt/emacs-bash-completion/issues/new). Please\n  include the output of `M-x bash-completion-debug`, the command you're\n  trying to use and the function or package providing completion for\n  that command and where to download it.\n\n## CONTRIBUTING\n\nTo report bugs, features, please open an [issue](\nhttps://github.com/szermatt/emacs-bash-completion/issues/new). To ask \nquestions or just for general comments, add a new [discussion](\nhttps://github.com/szermatt/emacs-bash-completion/discussions). To \ncontribute code or documentation, please open a [pull request](\nhttps://github.com/szermatt/emacs-bash-completion/pulls).\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md) for more details.\n\n## COMPATIBILITY\n\nbash-completion.el is known to work with Bash 4.2 and later and Bash\n5, on Emacs, starting with version 25.3, under Linux and OSX.\n","funding_links":[],"categories":["Emacs Lisp"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fszermatt%2Femacs-bash-completion","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fszermatt%2Femacs-bash-completion","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fszermatt%2Femacs-bash-completion/lists"}