{"id":13646641,"url":"https://github.com/abingham/emacs-ycmd","last_synced_at":"2026-02-12T07:30:16.804Z","repository":{"id":20145906,"uuid":"23416224","full_name":"abingham/emacs-ycmd","owner":"abingham","description":"Emacs client for ycmd, the code completion system.","archived":false,"fork":false,"pushed_at":"2022-01-20T19:04:34.000Z","size":1201,"stargazers_count":383,"open_issues_count":59,"forks_count":46,"subscribers_count":15,"default_branch":"master","last_synced_at":"2024-12-30T21:56:14.676Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Emacs Lisp","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/abingham.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-08-28T05:20:05.000Z","updated_at":"2024-10-26T10:01:47.000Z","dependencies_parsed_at":"2022-09-01T12:31:30.160Z","dependency_job_id":null,"html_url":"https://github.com/abingham/emacs-ycmd","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abingham%2Femacs-ycmd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abingham%2Femacs-ycmd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abingham%2Femacs-ycmd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abingham%2Femacs-ycmd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/abingham","download_url":"https://codeload.github.com/abingham/emacs-ycmd/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239809155,"owners_count":19700584,"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","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":[],"created_at":"2024-08-02T01:03:01.689Z","updated_at":"2026-02-12T07:30:16.752Z","avatar_url":"https://github.com/abingham.png","language":"Emacs Lisp","funding_links":[],"categories":["Emacs Lisp"],"sub_categories":[],"readme":"\n# **This package is currently unmaintained! If you want to take over maintenance, let me know in an issue.**\n\n# emacs-ycmd\n\n[![MELPA](http://melpa.org/packages/ycmd-badge.svg)](http://melpa.org/#/ycmd)\n[![MELPA Stable](https://stable.melpa.org/packages/ycmd-badge.svg)](https://stable.melpa.org/#/ycmd)\n[![Build Status](https://travis-ci.org/abingham/emacs-ycmd.png?branch=master)](https://travis-ci.org/abingham/emacs-ycmd)\n\nemacs-ycmd is a client for [ycmd](https://github.com/Valloric/ycmd),\nthe code completion system. It takes care of managing a ycmd server\nand fetching completions from that server.\n\nemacs-ycmd comprises a core set of functionality for communicating with ycmd as well as integration with the Emacs completion framework [company-mode](http://company-mode.github.io/).\n\nA lot of the concepts behind emacs-ycmd are actually concepts from\nycmd itself, so if you feel lost you might read\n[the ycmd documentation](https://github.com/Valloric/ycmd) and/or the\n[the original YouCompleteMe documentation](https://github.com/Valloric/YouCompleteMe).\n\n**Important:** The `ycmd` package itself doesn't provide a real UI for selecting and inserting completions into your files. For that you need to use [`company-ycmd`](#company-ycmd) or another \"completion framework\".\n\n## Quickstart\n\nFirst make sure that `ycmd` is installed on your system. See [the ycmd instructions](https://github.com/Valloric/ycmd#building) for more details.\n\nTo use `ycmd-mode` in all supported modes, add the following to your emacs config:\n\n```emacs\n(require 'ycmd)\n(add-hook 'after-init-hook #'global-ycmd-mode)\n```\n\nOr add `ycmd-mode` to a specific supported mode:\n\n```emacs\n(require 'ycmd)\n(add-hook 'c++-mode-hook 'ycmd-mode)\n```\n\nUse the variable `ycmd-server-command` to specify how to run the server. It will typically be something like:\n\n```emacs\n(set-variable 'ycmd-server-command '(\"python\" \"/path/to/ycmd/package/\"))\n```\n\nNB: We do not do filename expansion on the elements of `ycmd-server-command`. As\na result, paths using \"~\" to represent the home directory will not work\nproperly; you need to expand them yourself. For example:\n\n```emacs\n(set-variable 'ycmd-server-command `(\"python\" ,(file-truename \"~/.emacs.d/ycmd/ycmd/\")))\n```\n\nIf you've got a *global ycmd configuration*, specify that in your\nemacs configuration by setting `ycmd-global-config`:\n\n```emacs\n(set-variable 'ycmd-global-config \"/path/to/global_config.py\")\n```\n\n**Spacemacs users:** Note that if you don't set `ycmd-global-config`, spacemacs\nwill set it for you. This is not always what you want! See the spacemacs ycmd\ndocumentation for more info.\n\nIf you've got project-specific ycmd configurations (almost certainly\ncalled `.ycm_extra_conf.py`), and if you want them automatically\nloaded by ycmd as needed (which you probably do), then you can\n*whitelist* them by adding entries to `ycmd-extra-conf-whitelist`. For\nexample, this will allow automatic loading of all `.ycm_extra_conf.py`\nfiles anywhere under `~/my_projects`\n\n```emacs\n(set-variable 'ycmd-extra-conf-whitelist '(\"~/my_projects/*\"))\n```\n\nAlternatively, you can set `ycmd-extra-conf-handler` to control how\n`ycmd.el` deals with non-whitelisted extra configs. By default this is\nset to `'ask`, meaning it will ask the user each time one is encountered. The\nother options are `'ignore`, in which case the extra config will be\nignored, and `'load`, in which case the extra config will be loaded.\n\nNow a ycmd server will be automatically launched whenever it's\nneeded. Generally, this means whenever you visit a file with a\nsupported major mode. You should not normally need to manually start\nor stop a ycmd server.\n\nWith a server running, you can now get completions for a point in a\nfile using `ycmd-get-completions`. This doesn't actually insert the\ncompletions; it just fetches them from the server. It's not even an\ninteractive function, so you can't really call it while editing. If\nyou just want to see the possible completions at a point, you can try\n`ycmd-display-completions` which will dump a raw completion struct\ninto a buffer. This is more of a debugging tool than anything.\n\n## completion\n\nIt is recommended to use `company-mode` for completion, however there is basic support for Emacs' built-in completion mechanism.\n\n``` emacs\n(defun ycmd-setup-completion-at-point-function ()\n  \"Setup `completion-at-point-functions' for `ycmd-mode'.\"\n  (add-hook 'completion-at-point-functions\n            #'ycmd-complete-at-point nil :local))\n\n(add-hook 'ycmd-mode-hook #'ycmd-setup-completion-at-point-function)\n```\n\n## company-ycmd\n\n[![MELPA](http://melpa.org/packages/company-ycmd-badge.svg)](http://melpa.org/#/company-ycmd)\n[![MELPA Stable](https://stable.melpa.org/packages/company-ycmd-badge.svg)](https://stable.melpa.org/#/company-ycmd)\n\nMore likely, you'll want to use a completion framework like\n`company-mode` to manage the completions for you. Here's how to do\nthat:\n\n```emacs\n(require 'company-ycmd)\n(company-ycmd-setup)\n```\n\nAfter this you can use your standard `company-mode` keybindings to do\ncompletion.\n\n## IMPORTANT: Unbuffered output\n\nThere have been some reports that `ycmd.el` doesn't work when Python's output is buffered. See, for example, [issue #104](https://github.com/abingham/emacs-ycmd/issues/104). This is because we rely on the ycmd server printing out its host and port information in a timely (i.e. unbuffered) manner. We will almost certainly update the defaults for `ycmd.el` to force unbuffered output.\n\nIn any event, if you are facing problems with ycmd not starting and/or hanging Emacs, try adding `-u` to your `ycmd-server-command`. For example:\n```\n(set-variable 'ycmd-server-command '(\"c:/path/to/python.exe\" \"-u\" \"c:/path/to/ycmd\"))\n```\n\n## `flycheck` integration\n\n[![MELPA](http://melpa.org/packages/flycheck-ycmd-badge.svg)](http://melpa.org/#/flycheck-ycmd)\n[![MELPA Stable](https://stable.melpa.org/packages/flycheck-ycmd-badge.svg)](https://stable.melpa.org/#/flycheck-ycmd)\n\n`flycheck-ycmd.el` allows you to use `ycmd` as a backend for\n`flycheck`. With this enabled, whenever `ycmd` parses a file the\nresults will be passed to `flycheck` for display. This is a really\nnice way to get quick feedback on problems in your code.\n\nThe simple way to enable `flycheck` integration is to use `flycheck-ycmd-setup`:\n\n```emacs\n(require 'flycheck-ycmd)\n(flycheck-ycmd-setup)\n```\n\nThis will make sure that `flycheck` sees the parse results, and that\nthe `flycheck-ycmd` backend is enabled.\n\nIf for some reason you want to do this manually, the instructions are like this:\n\n```emacs\n(require 'flycheck-ycmd)\n\n;; Make sure the flycheck cache sees the parse results\n(add-hook 'ycmd-file-parse-result-hook 'flycheck-ycmd--cache-parse-results)\n\n;; Add the ycmd checker to the list of available checkers\n(add-to-list 'flycheck-checkers 'ycmd)\n```\n\n### Disabling ycmd-based flycheck for specific modes\n\nIf you use `flycheck-ycmd-setup` or otherwise put `ycmd` at the front of\n`flycheck-checkers`, flycheck will use the ycmd checker for every buffer in\n`ycmd-mode`. This may not be what you want. For example, even though ycmd\nsupports completion (and, thus, flycheck) for Python, you may wish to use\npyflakes for flychecking Python code.\n\nTo disable ycmd-based flychecking for specific modes, you can modify\nthe `flycheck-disabled-checkers` list in your mode hook. For example:\n\n```\n(add-hook 'python-mode-hook (lambda () (add-to-list 'flycheck-disabled-checkers 'ycmd)))\n```\n\nWith this, the ycmd checker will be ignored in `python-mode`. Since\n`flycheck-disabled-checkers` is buffer-local, the ycmd-based checker\nwill still be available for other modes.\n\n### Making flycheck and company work together\n\nIn some cases you may see that `company` and `flycheck` interfere with one another. You can end up with strange completion artifacts in your buffers. This mostly seems to happen when you run emacs in \"terminal mode\", i.e. with `emacs -nw`.\n\nThe short answer for how to deal with this is:\n```\n(setq flycheck-indication-mode nil)\n```\n\nThe slightly longer and probably better answer is:\n```\n(when (not (display-graphic-p))\n  (setq flycheck-indication-mode nil))\n```\n\nFor a full explanation see [the `emacs-ycmd` defect related to this](https://github.com/abingham/emacs-ycmd/issues/144) as well as [the root `flycheck` issue](https://github.com/flycheck/flycheck/issues/526).\n\n## `eldoc` integration\n\n`ycmd-eldoc` adds eldoc support for `ycmd-mode` buffers.\n\n``` emacs-lisp\n(require 'ycmd-eldoc)\n(add-hook 'ycmd-mode-hook 'ycmd-eldoc-setup)\n```\n\nNote: eldoc messages will only be shown for functions which are retrieved via semantic completion.\n\n\n## `next-error` integration\n\nemacs-ycmd reports found errors through emacs buttons; to integrate those with\n`next-error` prepend something like\n`(require 'ycmd-next-error)` before require'ing ycmd (after adding the\n`contrib` directory to your `load-path`).\n\n## Making `emacs-ycmd` quieter\n\nIn some common configurations `emacs-ycmd` can produce lots of messages, and\nsome people find these noisy and distracting. If you're seeing a lot of messages\nlike `Contacting host: 127.0.0.1:NNNNN` and you'd like to quiet them, set\n`url-show-status` to `nil`. This can effect non-ycmd-related buffers, so\nconsider using buffer-local settings if this worries you.\n\nYou might also see a flurry of messages like this:\n\n```\nREQUEST [error] Error (error) while connecting to http://127.0.0.1:38987/completions.\nREQUEST [error] Error (error) while connecting to http://127.0.0.1:38987/event_notification. [26 times]\n```\n\nThese almost never indicate something you need to be concerned about. To quiet\nthem, you can set `request-message-level` to `-1`.\n\nSee [issue #173](https://github.com/abingham/emacs-ycmd/issues/174) for the\ninitial discussion of this topic.\n\n## Running tests\n\n`emacs-ycmd` comes with a number of tests that you can run. This is mostly\nuseful for developers. They are built with `ert`, so you can run them using any\ntechnique that `ert` provides. For example:\n\n```emacs\n(require 'ycmd-test)\n(ert-run-tests-interactively \"ycmd-test\")\n```\n\nIt is also possible to run the tests on the command-line with the Makefile\nprovided in this repository. Before running test, you need to install the\n[Cask](http://cask.github.io/) in order to be able to install the package\ndependencies.\n\nYou can do this by running\n\n``` shell\nmake deps\n```\n\nThe other thing that is required is to have the `ycmd` folder right next to\n`emacs-ycmd` (`../ycmd`).\n\nTo run the tests:\n\n``` shell\nmake test\n```\n\nIt is also possible to have the `ycmd` server at a different location. In that\ncase the path needs to be passed to the `make` command explicitly:\n\n``` shell\nmake YCMDPATH='/path/to/ycmd/ycmd' test\n```\n\nMake sure that you provide the path to the ycmd module and not the ycmd root\ndirectory.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabingham%2Femacs-ycmd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabingham%2Femacs-ycmd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabingham%2Femacs-ycmd/lists"}