mirror of
https://github.com/vale981/py-vterm-interaction.el
synced 2025-03-05 10:01:41 -05:00
Make sure to run the correct per-buffer filter functions by using closure
This commit is contained in:
parent
9c6a7cd313
commit
fcb13f4906
1 changed files with 12 additions and 9 deletions
|
@ -109,7 +109,8 @@ recreated."
|
|||
(vterm-shell julia-vterm-repl-program))
|
||||
(with-current-buffer buffer
|
||||
(julia-vterm-repl-mode)
|
||||
(add-function :filter-args (process-filter vterm--process) #'julia-vterm-repl-run-filter-functions))
|
||||
(add-function :filter-args (process-filter vterm--process)
|
||||
(julia-vterm-repl-run-filter-functions-func session-name)))
|
||||
buffer)))
|
||||
|
||||
(defun julia-vterm-repl-buffer (&optional session-name restart)
|
||||
|
@ -149,14 +150,16 @@ If there's already one with the process alive, just open it."
|
|||
(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))))
|
||||
(defun julia-vterm-repl-run-filter-functions-func (session)
|
||||
"Return a function that runs registered filter functions for SESSION with args."
|
||||
(lambda (args)
|
||||
(with-current-buffer (julia-vterm-repl-buffer session)
|
||||
(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))))))
|
||||
|
||||
(defun julia-vterm-repl-buffer-status ()
|
||||
(let* ((bs (buffer-string))
|
||||
|
|
Loading…
Add table
Reference in a new issue