Reputation: 7469
I've set up company to load globally like this:
(let ((company-path "path/to/company"))
(add-to-list 'load-path company-path)
(autoload 'company-mode "company" nil t)
(global-company-mode t))
The problem is that it loads anew every time the minibuffer gets focus. Is there an easy way to disable this behavior? I would like to have it enabled in every file buffer, but not minibuffer.
Thanks.
Update:
A few clarifications.
First of all, what makes me think company-mode
loads every time I switch to minibuffer? Well, every time I type C-x
of M-x
, the minibuffer shows "Pymacs loading ropemacs..." and hangs for a split second. This behavior can be observed only with the global-company-mode
enabled, so I blamed it on the company
.
However, why blaming company
if it says pymacs
, right? So I went on and turned off the loading of pymacs
which looked like this in my .emacs file (taken straight from its installation instructions):
(defun load-pymacs ()
"Self-explanatory."
(add-to-list 'load-path (make-plugin-path "Pymacs"))
(autoload 'pymacs-apply "pymacs")
(autoload 'pymacs-call "pymacs")
(autoload 'pymacs-eval "pymacs" nil t)
(autoload 'pymacs-exec "pymacs" nil t)
(autoload 'pymacs-load "pymacs" nil t))
; make-plugin-path is a function defined somewhere else in my .emacs file.
(load-pymacs)
After commenting out the last line and restarting Emacs, the "Pymacs loading ropemacs..." message was gone even with company-mode
enabled globally. However, I still had to manually eval (company-mode)
before (global-company-mode t)
would work.
After this little investigation, I'd like to rephrase the original question a bit. I'm not familiar with the concepts of require
and autoload
in Emacs, so I'm asking for an advice here:
What exactly do I need to place in my .emacs file to make company
automatically turn on in every file-buffer (and not in minibuffer) and have Pymacs enabled along with it?
Thank you.
Upvotes: 1
Views: 1815
Reputation: 73344
Do you have the latest version? I was curious, so I tried it out by installing the ELPA package (listed as version 0.5), and enabled global-company-mode
, and it doesn't activate in the minibuffer for me. The ELPA package takes care of the autoloads as well.
If there's still a problem, you may be able to use minibuffer-setup-hook
(which is called whenever the minibuffer gets focus), to switch company mode off in that buffer.
FWIW, your code looks a bit odd to me. The let
variable is only used by the following line, so isn't really needed, and unless there's some automagic behaviour I'm not aware of, that autoload must be redundant if you can successfully call global-company-mode
without a similar declaration -- presumably either the library's own autoload comments have been processed, or the library has been loaded already?
Upvotes: 4