【问题标题】:auto-complete installation emacs自动完成安装emacs
【发布时间】:2023-03-10 20:56:01
【问题描述】:

我是 emacs 的新手,我正在尝试使用 Vincent Goulet 修改后的 emacs (https://vigou3.github.io/emacs-modified-windows/) 来完成我的工作(主要是 R 编程和 LaTeX)。修改后的 emacs 附带了 ess 安装,我正在尝试让自动完成工作。

我在输入M-x package-list-packages 时看不到company-modeauto-complete(虽然我看到auto-complete-[other things]company-[other things],但我无法安装auto-complete

我的.emacs文件如下:

;; Added by Package.el.  This must come before configurations of
;; installed packages.  Don't delete this line.  If you don't want it,
;; just comment it out by adding a semicolon to the start of the line.
;; You may delete these explanatory comments.
(package-initialize)

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(ansi-color-faces-vector
   [default default default italic underline success warning error])
 '(custom-enabled-themes (quote (tango-dark)))
 '(package-selected-packages (quote (auto-auto-indent auto-complete company))))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )

(require 'package)
(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
                    (not (gnutls-available-p))))
       (proto (if no-ssl "http" "https")))
  ;; Comment/uncomment these two lines to enable/disable MELPA and MELPA Stable as desired
  (add-to-list 'package-archives (cons "melpa" (concat proto "://melpa.org/packages/")) t)
  ;;(add-to-list 'package-archives (cons "melpa-stable" (concat proto "://stable.melpa.org/packages/")) t)
  (when (< emacs-major-version 24)
    ;; For important compatibility libraries like cl-lib
    (add-to-list 'package-archives '("gnu" . (concat proto "://elpa.gnu.org/packages/")))))
(package-initialize)


(setq ess-use-company t)

R 中自动完成代码的任何帮助都会非常有帮助。谢谢。

【问题讨论】:

  • @jenesaisquoi - 感谢您的评论,我认为安装 auto-complete 后我可以自动完成,但 ?help 会自动在网络浏览器中为我打开,可以这种行为被控制在R 本身中打开?谢谢!
  • 谢谢,是的,?print 中的 R 解释器将打开 Web 浏览器,而不是在解释器本身中显示帮助。
  • 这是我做(print inferior-ess-help-command),然后Ctrl-j(获取变量的值)时得到的结果-"utils::help(\"%s\") " "utils::help(\"%s\") "
  • 嗯..getOption("help_type") 给出"html"。我在C:\Program Files\R\R-3.5.0\library\base\R 的“Rprofile”文件中更改了它,使用options(help_type = "text") 并重新启动emacs,仍然是同样的问题。但是,如果我在解释器中输入相同的内容,我会看到 ? 的帮助现在在新缓冲区中打开。
  • C:\Program Files\R\R-3.5.0\etc\Rprofile.site 中将选项更改为文本(它已经存在,仅评论)有效!

标签: emacs ess melpa


【解决方案1】:

这似乎不是 ESS 的问题,而是 R 选项。 R 选项help_type 应设置为“text”而不是“html”(这可能是 Windows 上的默认设置?)。这可以通过添加options(help_type="text").Rprofile 配置文件(用户文件应位于Sys.getenv("HOME"))中设置选项来更改。

请注意,您的配置 ess-use-company 告诉 ESS 使用与 ESS 捆绑在一起的 company 后端,而不是 auto-complete 库(在 emacs 中提供补全的两个不同包)。

您可能希望将 (global-company-mode) 添加到您的 init 文件中以完成运行所有缓冲区(或在您的 ess 挂钩中启用它)。我还建议您查看 company-quickhelp 以获取完成菜单中的信息。

【讨论】:

    猜你喜欢
    • 2015-01-05
    • 2016-06-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-05-04
    • 1970-01-01
    • 2016-09-07
    相关资源
    最近更新 更多