【问题标题】:How do I get ESS to recognize a dynamic prompt in R?如何让 ESS 识别 R 中的动态提示?
【发布时间】:2013-02-21 18:25:40
【问题描述】:

我按照这里的建议...R: Display a time clock in the R command line 使我的 R 提示符在我最后一次输入命令时显示。但是现在M-rM-p 坏了,因为 ESS 不再将我不断变化的命令提示符识别为命令行的开始。

是否有人知道要更改什么选项,以便对于必须检测提示的所有目的,而不是匹配整个提示字符串,ESS 将只匹配它的常量尾端,或者更好的是,像“^”这样的正则表达式[0-9]{6} [0-9]{2}:[0-9]{2} >"

谢谢。

【问题讨论】:

  • 知道ESS 目前正在查看什么来识别提示吗?我的意思是R 中代表提示字符串的项目。

标签: r command-prompt ess


【解决方案1】:

我的ess/ess-custom.el 包含以下几行:

;; does it make sense to customize here, as we currently set this *directly*
;; in the FOO-BAR-cust-alist's ???
;; VS: Right. It only confuses users. It should be set in post-run-hook if
;; desired;  inferior-S-prompt should be customized instead.
(defvar inferior-ess-primary-prompt "> "
  "Regular expression used by `ess-mode' to detect the primary prompt.")

(make-variable-buffer-local 'inferior-ess-primary-prompt)
;; (setq-default inferior-ess-primary-prompt "> ")

(defvar inferior-ess-secondary-prompt nil
  "Regular expression used by ess-mode to detect the secondary prompt.
(This is issued by S to continue an incomplete expression).
Set to nil if language doesn't support secondary prompt.")
;; :group 'ess-proc
;; :type 'string)

(make-variable-buffer-local 'inferior-ess-secondary-prompt)
;; (setq-default inferior-ess-secondary-prompt "+ ")

;; need to recognise  + + + > > >
;; and "+ . + " in tracebug prompt
(defcustom inferior-S-prompt "[]a-zA-Z0-9.[]*\\([>+.] \\)*[+>] "
  "Regexp used in S and R inferior and transcript buffers for prompt navigation.

You can set it to \"[]a-zA-Z0-9.[]*\\(> \\)+\" if you want to
skip secondary prompt when invoking `comint-previous-prompt'.
 "
  :group 'ess-proc
  :type 'string)

所以我希望自定义这些变量中的任何一个都会有所帮助。可能从可定制的开始,即inferior-S-prompt

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-01-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多