mirror of
https://github.com/vale981/py-vterm-interaction.el
synced 2025-03-04 17:41:40 -05:00
Implement a function to run filter functions
This commit is contained in:
parent
d36dde1c7e
commit
94724837aa
1 changed files with 14 additions and 1 deletions
|
@ -108,7 +108,8 @@ recreated."
|
|||
(let ((buffer (generate-new-buffer (julia-vterm-repl-buffer-name session-name)))
|
||||
(vterm-shell julia-vterm-repl-program))
|
||||
(with-current-buffer buffer
|
||||
(julia-vterm-repl-mode))
|
||||
(julia-vterm-repl-mode)
|
||||
(add-function :filter-args (process-filter vterm--process) #'julia-vterm-repl-run-filter-functions))
|
||||
buffer)))
|
||||
|
||||
(defun julia-vterm-repl-buffer (&optional session-name restart)
|
||||
|
@ -145,6 +146,18 @@ If there's already one with the process alive, just open it."
|
|||
(goto-char (point-min))
|
||||
(vterm-clear 1)))
|
||||
|
||||
(defvar-local julia-vterm-repl-filter-functions '()
|
||||
"List of filter functions that process the output to the REPL buffer.")
|
||||
|
||||
(defun julia-vterm-repl-run-filter-functions (args)
|
||||
"Run registered filter functions with ARGS."
|
||||
(let ((proc (car args))
|
||||
(str (cadr args)))
|
||||
(let ((funcs julia-vterm-repl-filter-functions))
|
||||
(while funcs
|
||||
(setq str (apply (pop funcs) (list str))))
|
||||
(list proc str))))
|
||||
|
||||
(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)
|
||||
|
|
Loading…
Add table
Reference in a new issue