【问题标题】:How to prevent firefox to be opened after exporting document with polymode markdown in R?如何防止在R中使用polymode markdown导出文档后打开firefox?
【发布时间】:2021-04-12 16:57:14
【问题描述】:

我使用 Emacs ESS 作为我的 R 编程环境

OS: Ubuntu 20.04 (x86_46)
Emacs version: 27.1

我的 init 文件中有以下 polymode 配置(我从 MELPA 安装了三个包:polymode、poly-markdown 和 poly-r)

; ==========================
; Polymode for R markdown
; ==========================
; M-x package-install [RET] polymode [RET]
; M-x package-install [RET] poly-markdown [RET]
; M-x package-install [RET] poly-R [RET]
;
(use-package polymode
       :diminish (poly-org-mode
              poly-markdown-mode
              poly-noweb+r-mode
              poly-noweb+r-mode
              poly-markdown+r-mode
              poly-rapport-mode
              poly-html+r-mode
              poly-brew+r-mode
              poly-r+c++-mode
              poly-c++r-mode)
       :init
       (require 'poly-R)
       (require 'poly-markdown)
       :config
       (add-to-list 'auto-mode-alist '("\\.md$" . poly-markdown-mode))
       (add-to-list 'auto-mode-alist '("\\.Rmd$" . poly-markdown+r-mode))
       (add-to-list 'auto-mode-alist '("\\.Rcpp$" . poly-r+c++-mode))
       (add-to-list 'auto-mode-alist '("\\.cppR$" . poly-c++r-mode))
       )

这行得通。我按下M-n e,这会运行并生成一个 html 文档,最后程序会使用生成的 html 文件的内容打开 Firefox 浏览器。我想做的是只生成 html 文档但不打开浏览器。事实上,我通过 eww 在 emacs 中查看生成的 html 页面,并在每次 html 导出后按g 重新加载页面。

当我创建 Markdown 时,我将当前 Emacs 窗口拆分为三个缓冲区,如下所述:

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+   Here is the buffer      +                            +
+   in which I write        +   This eww buffer acts as  +
+   my markdown file with   +   my web browser and       +
+   my R programs.          +   shows the content of     +
+++++++++++++++++++++++++++++   the generated HTML file  +
+   Here is the buffer for  +   as if I was viewing it   +
+   R to run the program    +   via Google Chrome,       +
+   and generate the HTML   +   Firefox etc.             +
+   file with all messages. +                            +
+                           +   Each time there is a new +
+                           +   version of the HTML      +
+                           +   document I come back to  +
+                           +   this buffer and after    +
+                           +   pressing 'g' I reload    +                           
+                           +   the page.                +
+                           +                            +
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

在 Emacs 中以这种方式工作对我来说似乎很方便。结果,没有理由在生成文件的每个新版本后打开 Firefox 窗口,这很烦人,每次我都必须手动关闭它。

所以我的问题是:是否有任何命令只运行程序并生成 HTML 文件而不用 Firefox 打开它?

【问题讨论】:

    标签: r emacs r-markdown


    【解决方案1】:

    我在https://stackoverflow.com/a/58573524/7204113找到了您问题的答案

    (setq polymode-display-output-file nil)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-03-28
      • 1970-01-01
      • 1970-01-01
      • 2016-05-19
      • 2015-06-07
      • 2021-04-29
      • 2020-01-30
      相关资源
      最近更新 更多