From: "Louis Höfler" <louis.hoefler@mathematek.de>
To: emacs-devel@gnu.org
Subject: Adding a filter function to a shell process
Date: Thu, 05 Mar 2015 02:16:37 +0100 [thread overview]
Message-ID: <54F7AE75.7050203@mathematek.de> (raw)
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
reply other threads:[~2015-03-05 1:16 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54F7AE75.7050203@mathematek.de \
--to=louis.hoefler@mathematek.de \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.