# \[Emacs\] hiding completion on save

**URL:** <https://discuss.ocaml.org/t/emacs-hiding-completion-on-save/2986>\
**Category:** Learning\
**Tags:** spacemacs, editor, emacs, ide\
**Created:** [December 1, 2018, 11:33am UTC](https://discuss.ocaml.org/t/emacs-hiding-completion-on-save/2986 "2018-12-01T11:33:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kakadu](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/kakadu/32/1204_2.png) [@Kakadu](https://discuss.ocaml.org/u/Kakadu)\
**Post date:** [December 1, 2018, 11:33am UTC](https://discuss.ocaml.org/t/emacs-hiding-completion-on-save/2986/1 "2018-12-01T11:33:51Z")

</div>

I’m using ergo+spacemacs with company mode completion plugin. I want to make completion window to close after I save the file with hotkey. I don’t know where should I look for it: in emacs key combinations, in company-mode code or somewhere else.

_Why I want this._ When I type some identifiers the autocompletion engine proposes some long names that already has been defined. But I want to define new short name! There is no obvious way to abandon completion window in this case: ESC and Ctrl+S (or C-X C-S in normal emacs) don’t close it. I want automatically close completion window after saving because my previous IDE did this.

Did you have similar issues? How did you resolve this?

---

<div class="post-metadata">

**Author:** ![perry](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/perry/32/518_2.png) [@perry](https://discuss.ocaml.org/u/perry)\
**Post date:** [December 1, 2018, 11:42pm UTC](https://discuss.ocaml.org/t/emacs-hiding-completion-on-save/2986/2 "2018-12-01T23:42:25Z")

</div>

I suspect that some of this must be an issue specific to the use of evil mode; when I work in emacs using the normal keybindings etc., completion windows go away pretty much at will, and at worst if you C-g they are gone.

---

<div class="post-metadata">

**Author:** ![Kakadu](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/kakadu/32/1204_2.png) [@Kakadu](https://discuss.ocaml.org/u/Kakadu)\
**Post date:** [December 2, 2018, 9:19am UTC](https://discuss.ocaml.org/t/emacs-hiding-completion-on-save/2986/3 "2018-12-02T09:19:22Z")

</div>

C-g works but I want to configure this hotkey.

---

<div class="post-metadata">

**Author:** ![perry](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/perry/32/518_2.png) [@perry](https://discuss.ocaml.org/u/perry)\
**Post date:** [December 2, 2018, 4:35pm UTC](https://discuss.ocaml.org/t/emacs-hiding-completion-on-save/2986/4 "2018-12-02T16:35:14Z")

</div>

I don’t see what the advantage is, but you can always hack the elisp to do exactly what you want, including binding whatever key you like (say C-s) to a new function that closes transient buffers before calling save.

---

<div class="post-metadata">

**Author:** ![Kakadu](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/kakadu/32/1204_2.png) [@Kakadu](https://discuss.ocaml.org/u/Kakadu)\
**Post date:** [December 2, 2018, 6:01pm UTC](https://discuss.ocaml.org/t/emacs-hiding-completion-on-save/2986/5 "2018-12-02T18:01:04Z")

</div>

Yes, but my first idea was to check if it is available out of box.
