unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Adding a filter function to a shell process
@ 2015-03-05  1:16 Louis Höfler
  0 siblings, 0 replies; only message in thread
From: Louis Höfler @ 2015-03-05  1:16 UTC (permalink / raw)
  To: emacs-devel

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




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-03-05  1:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-05  1:16 Adding a filter function to a shell process Louis Höfler

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).