<p>cider-switch-to-repl-buffer 应该切换到相关的(不是最近的)缓冲区</p>

创建于 2017-09-08  ·  3评论  ·  资料来源: clojure-emacs/cider

一些人( @magnars @dpsutton jumar?)昨天在 Clojurians 上讨论了我注意到的一个问题。 我没有所有的细节,但我从他们的描述中借用了,但会尽力帮助报告。

文档说“要根据当前 Clojure 缓冲区中的 Clojure 命名空间切换到相关的 REPL 缓冲区,请使用: C-c C-z 。” 从cljs-mode,它应该切换到项目的cljs-repl; 从 clojure-mode 它应该切换到项目的 clj-repl。

相反,它切换到最新的 REPL。

@dpsutton说它与以下内容有关: https :

要重现问题:

  • 使用 CLJ 和 CLJS 创建一个项目。
  • 导航到该项目中的一个文件,然后运行 ​​cider-jack-in-clojurescript。
  • 切换到 CLJ REPL 缓冲区。
  • 导航到 CLJS 文件缓冲区。
  • 点击 Cc Cz(苹果酒切换到 repl 缓冲区)。 它将切换到 CLJ REPL 缓冲区,而不是 CLJS REPL 缓冲区。

莱宁根 2.7.1

Emacs:25.2.1

Arch/Antergos Linux

最有用的评论

这是至少解决 CLJS 案例的 PR #2085。
对我来说,在 CLJC 文件中切换时不清楚。

所有3条评论

我的想法是 repl 分辨率是问题所在。 在cider-current-connection ,当有多个连接时,它只会依赖最近的连接,这对我来说似乎是错误的。 这听起来像是一个应该进一步向下的解决策略。 我在 clj repl 中加载了 cljs 缓冲区的实例,在其他项目 repl 中加载了 clj 文件。

  (cond
   ((not connections) nil)
   ;; if you're in a REPL buffer, it's the connection buffer
   ((and (derived-mode-p 'cider-repl-mode) (right-type-p (current-buffer) type)))
   ((eq cider-request-dispatch 'static) (car connections))
   ((= 1 (length connections)) (right-type-p (car connections) type))
   (t (let ((project-connections (cider-find-connection-buffer-for-project-directory
                                  nil :all-connections))
            (guessed-type (or type (cider-connection-type-for-buffer))))
        (or
         ;; cljc
         (and (equal guessed-type "multi")
              (most-recent-buf project-connections nil))
         ;; clj or cljs
         (and guessed-type
              (or (most-recent-buf project-connections guessed-type)
                  (most-recent-buf connections guessed-type)))
         ;; when type was not specified or guessed
         (most-recent-buf project-connections type)
         (most-recent-buf connections type)))))

问题直接在于cider-switch-to-repl-buffer 。 顺便说一句,同样的问题显示cider-switch-to-last-clojure-buffer 。 会看看。

这是至少解决 CLJS 案例的 PR #2085。
对我来说,在 CLJC 文件中切换时不清楚。

此页面是否有帮助?
0 / 5 - 0 等级

相关问题

achikin picture achikin  ·  7评论

MicahElliott picture MicahElliott  ·  7评论

xificurC picture xificurC  ·  5评论

ukriish picture ukriish  ·  6评论

manuel-uberti picture manuel-uberti  ·  4评论