43

Disclaimer: I'm the author of irony-mode If you just want smart auto-completion, I can recommend irony-mode with company-irony. irony-mode is easy to install thanks to MELPA the completion is very accurate and the performance quite decent thanks to libclang with company-irony you have an asynchronous completion backend that will not get in your way if the ...


39

They're pretty much equivalent, but company-mode has a better thought-out API for plugin developers. It's also much more actively maintained. But there are two key differences which may or may not matter to you: Firstly, company-mode now targets Emacs 24, so if you're stuck with Emacs 23 then you're out of luck. auto-complete still works with Emacs 23. ...


32

I've used autocomplete-mode for a good a few years and switched to company-mode a couple of months ago. In basic usage there's not much of a difference. Like someone else posted this link has a good summary of the differences. I found company-mode to be easier to configure and to let it do what I want it to. With autocomplete-mode I ran into issues now and ...


28

I have the following snippet in my configuration and it seems like it's exactly what you want: ;; Add yasnippet support for all company backends ;; https://github.com/syl20bnr/spacemacs/pull/179 (defvar company-mode/enable-yas t "Enable yasnippet for all backends.") (defun company-mode/backend-with-yas (backend) (if (or (not company-mode/enable-yas) (...


22

Check my guide. It lists several methods for auto-completion in C/C++. Those options are: Using Irony. Highly recommended, since it uses Clang and easy to setup compared with other solutions. Using the built-in parser from Emacs. It is the best auto-complete you can get is from within Emacs parser, Semantic, but it would be slow on large project like ...


19

Emacs's builtin completion functionality offers similar fuzzy matching (tho by default it's used for "do-so-am" rather than for "DoSoAm") and IIUC recent versions of company-mode do use this at least in some cases. E.g. if you open an Elisp buffer using Emacs-24.4 and the latest company-mode, if you type (wi-sy company will pop up a completion menu showing ...


17

Documentation The API completion at point function can be found in the documentation of completion-at-point-functions Each function on this hook is called in turns without any argument and should return either nil to mean that it is not applicable at point, or a function of no argument to perform completion (discouraged), or a list of the form (...


13

There is an adaptive sorting option for Helm which sorts the result according to their usage frequency. According to the helm source code it can be activated with the minor mode helm-adaptive-mode: https://github.com/emacs-helm/helm/blob/master/helm-adaptive.el


12

You can set company-minimum-prefix-length to a desire value of your choice: (setq company-minimum-prefix-length 2) You can use the customize interface M-x customize and search for company in there using the search box. It will list relevant options related to the package. You can also search for a variable with C-h v or search for a command with C-h a, ...


12

As @Jesse already pointed out, what you want here is the company-files backend. There are several different ways to use it: Bind a key to call company-files directly. Use command company-begin-backend. This prompts you for the backend to use, then offers completion candidates. Use company-other-backend to rotate through the list of backends (see next item)...


11

I had also a bad experience with company at the beginning, but in my setup I just put these lines. (setq company-dabbrev-downcase 0) (setq company-idle-delay 0) The first variable is used to skip the downcase that company does to the variables I autocomplete, the second one I think you already have. (defun tab-indent-or-complete () (interactive) (if (...


11

The Org Manual node on Motion gives a somewhat laconic description of the built-in command org-goto (default binding: C-c C-j), whose behaviour can easily be customised to achieve the desired effect: Inspect the documentation of the customisable variable listed at the end of this manual node: C-h v org-goto-interface RET If you are happy to forgo the ...


10

Call unload-feature to undefine all symbols that were defined as part of loading an Elisp source or byte-compiled file. Make sure that your file ends by calling provide at the end. This assumes that you loaded the file with one of the load functions or via require, it won't undefined symbols defined by C-M-x (eval-defun) or similar mechanisms. If you really ...


9

With company-mode, you can use C-s to search from available candidates that it display. The search query is displayed in the modeline (not really easy to spot, I know. I filed an issue here). If you want to use Helm for completion, consider using helm-company or ac-helm. Haven't tried with ac-helm, but with helm-company, you can directly bind it to a key to ...


9

I've had great success with RTags + Company. RTags needs a separate daemon rdm running that uses clang for code-completion, code-navigation and refactoring. rdm also functions as a database of symbols, meaning that autocompletion is much faster than any solution just directly calling clang_codeCompleteAt. Rdm needs info of compilation flags for your ...


9

A good answer would be quite long. The short answer is yes. Each of Helm and Icicles offers features not offered by the other. They are not necessarily alternatives/competitors. You can use both. Wrt your question about matching candidates, there is no difference wrt showing all candidates. IOW, Icicles too will show all candidates anytime you like (...


9

Try using dabbrev with M-/, it expands strings from the same and other buffers inline. A more powerful alternative you can customize with your own functions is hippie-expand.


9

I think what you're looking for is C-M-j (ivy-immediate-done) in the mini buffer. This function is described as follows in the Ivy manual: Exits with the current input instead of the current candidate (like other commands). This is useful e.g. when you call find-file to create a new file, but the desired name matches an existing file. In that ...


8

See libraries cus-edit.el and wid-edit.el (and their top-level libraries custom.el and widget.el, and associated component libraries), which are included with GNU Emacs. The former makes use of the latter. The latter defines basic (and not-so-basic) form-entry thingies, called "widgets", in a hierarchy. You can use these predefined widgets and functions in ...


8

You have to run company-files for file completion. You can bind a different map for the files completion completion with (define-key global-map (kbd "C-.") 'company-files) Also make sure you have the company-files in company-backends (M-x > customize-group > company > company backends)


8

As @wasamasa suggested, ido-ubiquitous should take care of completion when insert-char is used. There is a bug report that was closed in 2013, but I still see this behaviour with Emacs 24.4 and ido-ubiquitous version 20140904.1547, so I filed another bug report. EDIT: The maintainer of ido-ubiquitous wrote this: Ok, I figured out the problem. There are ...


8

company-mode provides slightly better results than auto-complete using the bundled company-css backend. You get completion of property names (up-to-date with the current state of CSS3, AFAIK), and some completion of property values, where they are simple, like a fixed set of options.


8

This can be solved by modifying company-transformers with the following code: (push (apply-partially #'cl-remove-if (lambda (c) (or (string-match-p "[^\x00-\x7F]+" c) (string-match-p "[0-9]+" c) (if (equal major-mode "org") (&...


8

I use the package worf, but I bind only one of its functions: (use-package worf :diminish worf-mode :bind (:map org-mode-map ("C-c h" . worf-goto))) worf-goto gives you a list of the headings in the buffer in the mini buffer, which you can then filter. The package is made by the author of ivy, so if you like ivy, you might like worf. Some ...


7

Unless you invoke one of the completion commands directly (such as M-x company-complete-common), the completion maybe-happens and the popup is rendered in company-post-command. It looks at the current command, sees if it satisfies the value of company-begin-commands, and calls company--perform. The latter looks at the buffer contents, and checks whether ...


7

I added the following code to solve most of my problem: (setq ac-source-yasnippet nil) But, it caused complexity between yasnippet and auto-complete so I added this: (define-key yas-minor-mode-map (kbd "<tab>") nil) (define-key yas-minor-mode-map (kbd "TAB") nil) (define-key yas-minor-mode-map (kbd "<backtab>") 'yas-expand) Modified some ...


7

My complete setup for fixing this annoying default behavior is: ;;; Prevent suggestions from being triggered automatically. In particular, ;;; this makes it so that: ;;; - TAB will always complete the current selection. ;;; - RET will only complete the current selection if the user has explicitly ;;; interacted with Company. ;;; - SPC will ...


7

I use helm-M-x. It's part of the package helm. You can view a command's description with helm-execute-persistent-action.


6

Solution 1: company-mode + clang The only issue is you need tell company-mode where to search your project's c/c++ header files. If you use cmake, you can let https://github.com/redguardtoo/cpputils-cmake to do the setup for you (HINT: I'm the author of cpputils-cmake). OR Solution 2: company-mode + gnu global Nothing more to say, you need build the ...


6

This is really a limitation of Emacs' overlay system, upon which auto-complete and popup rely: the overlays are positioned using text column offsets, not pixels. So your options are indeed as you outlined. The path of least resistance is to use a fixed-width font with a variety of styles. My personal favourite is Input Mono, FWIW.


Only top voted, non community-wiki answers of a minimum length are eligible