From d36dde1c7eaac7c55a4cefa6f27ba08fc8d67102 Mon Sep 17 00:00:00 2001 From: shg <55463+shg@users.noreply.github.com> Date: Mon, 2 May 2022 00:05:46 +0900 Subject: [PATCH] Add julia-vterm-fellow-repl-buffer-status Bump version to 0.14 --- julia-vterm.el | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/julia-vterm.el b/julia-vterm.el index ec4e7ca..81b62f4 100644 --- a/julia-vterm.el +++ b/julia-vterm.el @@ -7,7 +7,7 @@ ;; Created: March 11, 2020 ;; URL: https://github.com/shg/julia-vterm.el ;; Package-Requires: ((emacs "25.1") (vterm "0.0.1")) -;; Version: 0.13 +;; Version: 0.14 ;; Keywords: languages, julia ;; This file is not part of GNU Emacs. @@ -279,6 +279,20 @@ With a prefix argument ARG (or interactively C-u), use Revise.includet() instead (defalias 'julia-vterm-sync-wd 'julia-vterm-send-cd-to-buffer-directory) +(defun julia-vterm-fellow-repl-buffer-status () + "Return REPL mode or nil if REPL is not ready for input." + (with-current-buffer (julia-vterm-fellow-repl-buffer) + (let ((tail (substring (buffer-string) -64))) + (set-text-properties 0 (length tail) nil tail) + (let* ((lines (split-string (string-trim-right tail "[\t\n\r]+") + (char-to-string ?\n))) + (prompt (car (last lines)))) + (pcase prompt + ("julia> " :julia) + ("help?> " :help) + ((rx "(@v" (1+ (in "0-9.")) ") pkg> ") :pkg) + ("shell> " :shell)))))) + (unless (fboundp 'julia) (defalias 'julia 'julia-vterm-repl))