I have a debugging/monitoring system for a particular application. I would like to allow monitoring/debugging from an emacs session, and have it run automatically.
Is there a way to have an emacs execute the following code without passing anything on the command line or forcing the user to run a command? I don't want to put it into the emacs init file because I don't want to be running useless debug monitors when users are not running the application.
(defun filter-output (process output)
(eval (read output)))
(defun doit ()
(let ((myproc (start-process "my-process" "*My DebugMonitor*" "/tmp/myProcess.py")))
(set-process-query-on-exit-flag myproc nil)
(set-process-filter myproc 'filter-output)))
If by automatically you mean that it will be run once when an Emacs session is created, and you don't want it to be on the command line (eg part of a startup script that invokes an OS command), and you don't want it to be in the user's init file, then consider placing it in default.el
or site-start.el
. See the Emacs manual, node Init File
.
If by automatically you mean that it should be run periodically or run when some event triggers it, then invoke it from a timer. See the Elisp manual, node Timers
.
Unclear what you're asking, but it sounds like you want it to be executed by an external event. Try
emacsclient -e doit
But of course you will still have to put that code in the init file, so it knows what doit
is .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.