[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Adding a filter function to a shell process
From: |
Louis Höfler |
Subject: |
Adding a filter function to a shell process |
Date: |
Thu, 05 Mar 2015 02:16:37 +0100 |
User-agent: |
Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 |
Hello everyone,
I try to read output from a (shell "buffer") call, to a string.
I came up with this function:
(defun eide-shell-read-filter (process string)
(setq eide-shell-output-temp string)
)
(defun ei-shell-read (procid cmd)
"This function sends commands to a opened shell and stores it's output
into a variable"
(eide-debug-message "ei-shell-read: cmd = %s" cmd)
(eide-debug-message "ei-shell-read: process-filter = %S"
(process-filter (get-process "shell")))
(add-function :after (process-filter (get-process "shell"))
#'eide-shell-read-filter)
(process-send-string procid (concat cmd "\n"))
(remove-function (process-filter (get-process "shell"))
#'eide-shell-read-filter)
(eide-debug-message "ei-shell-read: command output = %s"
eide-shell-output-temp)
eide-shell-output-temp
)
But the above code produces this error for M-x ei-interactive-shell:
Debugger entered--Lisp error: (void-variable v)
(process-filter v)
(lambda nil (process-filter v))()
advice--add-function(:after ((lambda nil (process-filter v)) lambda
(gv--val) (set-process-filter v gv--val)) eide-shell-read-filter nil)
ei-shell-read("*msys2-64*" "export")
You can download the full sourcecode of the project here
http://scm.mathematek.de/repos.cgi/emacside
Can someone help me with this problem?
Thank you, Louis
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Adding a filter function to a shell process,
Louis Höfler <=