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))
|
(vterm-shell julia-vterm-repl-program))
|
||||||
(with-current-buffer buffer
|
(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))
|
(add-function :filter-args (process-filter vterm--process)
|
||||||
|
(julia-vterm-repl-run-filter-functions-func session-name)))
|
||||||
buffer)))
|
buffer)))
|
||||||
|
|
||||||
(defun julia-vterm-repl-buffer (&optional session-name restart)
|
(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 '()
|
(defvar-local julia-vterm-repl-filter-functions '()
|
||||||
"List of filter functions that process the output to the REPL buffer.")
|
"List of filter functions that process the output to the REPL buffer.")
|
||||||
|
|
||||||
(defun julia-vterm-repl-run-filter-functions (args)
|
(defun julia-vterm-repl-run-filter-functions-func (session)
|
||||||
"Run registered filter functions with ARGS."
|
"Return a function that runs registered filter functions for SESSION with args."
|
||||||
(let ((proc (car args))
|
(lambda (args)
|
||||||
(str (cadr args)))
|
(with-current-buffer (julia-vterm-repl-buffer session)
|
||||||
(let ((funcs julia-vterm-repl-filter-functions))
|
(let ((proc (car args))
|
||||||
(while funcs
|
(str (cadr args)))
|
||||||
(setq str (apply (pop funcs) (list str))))
|
(let ((funcs julia-vterm-repl-filter-functions))
|
||||||
(list proc str))))
|
(while funcs
|
||||||
|
(setq str (apply (pop funcs) (list str))))
|
||||||
|
(list proc str))))))
|
||||||
|
|
||||||
(defun julia-vterm-repl-buffer-status ()
|
(defun julia-vterm-repl-buffer-status ()
|
||||||
(let* ((bs (buffer-string))
|
(let* ((bs (buffer-string))
|
||||||
|
|
Loading…
Add table
Reference in a new issue