mirror of
https://github.com/vale981/py-vterm-interaction.el
synced 2025-03-04 17:41:40 -05:00
Add julia-vterm-repl-buffer-status
This commit is contained in:
parent
443924f6eb
commit
90bce73aa4
1 changed files with 13 additions and 10 deletions
|
@ -158,6 +158,18 @@ If there's already one with the process alive, just open it."
|
|||
(setq str (apply (pop funcs) (list str))))
|
||||
(list proc str))))
|
||||
|
||||
(defun julia-vterm-repl-buffer-status ()
|
||||
(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)))))
|
||||
|
||||
(defvar julia-vterm-repl-copy-mode-map
|
||||
(let ((map (make-sparse-keymap)))
|
||||
(define-key map (kbd "C-c C-t") #'julia-vterm-repl-copy-mode)
|
||||
|
@ -295,16 +307,7 @@ With a prefix argument ARG (or interactively C-u), use Revise.includet() instead
|
|||
(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))))))
|
||||
(julia-vterm-repl-buffer-status)))
|
||||
|
||||
(unless (fboundp 'julia)
|
||||
(defalias 'julia 'julia-vterm-repl))
|
||||
|
|
Loading…
Add table
Reference in a new issue