本文介绍了在minibuffer中禁用公司模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经设立公司以全球方式加载:

 (let((company-pathpath / to / company))
(add-to-list'load-path company-path)
(autoload'company-modecompanynil t)
(global-company-mode t ))

问题是每次微型缓存器重点加载时都会重新加载。有没有一个简单的方法来禁用这种行为?我想在每个文件缓冲区中启用它,而不是minibuffer。



谢谢。



更新:



一些说明。



首先, code> company-mode 加载每次我切换到minibuffer?那么,每当我输入 Cx Mx ,minibuffer显示Pymacs加载ropemacs ...并挂起分秒只有使用 global-company-mode 可以观察到这种情况,所以我把它归咎于公司。 / p>

但是,如果说 pymacs ,为什么责怪公司对?所以我继续关闭在.emacs文件中看起来像这样的 pymacs 的加载(直接从安装说明中取出):

 (defun load-pymacs()
自解释
(add-to-list'load-path(make-
(autoload'pymacs-applypymacs)
(autoload'pymacs-callpymacs)
(autoload'pymacs-evalpymacsnil t
(autoload'pymacs-execpymacsnil t)
(autoload'pymacs-loadpymacsnil t))
; make-plugin-path是我的.emacs文件中其他地方定义的一个函数。

(load-pymacs)

注释掉最后一行并重新启动Emacs,即使在全球启用了 company-mode ,Pymacs loading ropemacs ...消息也消失了。但是,在(global-company-mode t)将工作之前,我仍然需要手动评估(公司模式)



经过这次调查,我想重新说一下原来的问题。我不熟悉Emacs中 require autoload 的概念,所以我在这里要求一个建议:



究竟需要放在我的.emacs文件中,使公司在每个文件中自动打开-buffer(而不是在minibuffer中),并且已经启用Pymacs?



谢谢。

解决方案

你有最新版本吗?我很好奇,所以我通过安装软件包(列为0.5版本),并启用了 global-company-mode ,它不会在我的minibuffer中激活。 ELPA包也负责自动加载。



如果仍然有问题,您可以使用 minibuffer-setup-hook (在minibuffer获得焦点时调用),在该缓冲区中切换公司模式。



FWIW,您的代码看起来有点奇怪我。 let 变量仅用于以下行,因此不是真的需要,除非有一些我不知道的自动化行为,否则自动加载必须是冗余的您可以成功调用 global-company-mode 而不用类似的声明 - 大概是已经处理了库自己的自动加载注释,或者库已经加载了?


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.

解决方案

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?

这篇关于在minibuffer中禁用公司模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-25 05:20