Initial Query

In emacs lisp how do I silence "Process python-process finished"

LLM Generation

Query

In emacs lisp how do I silence "Process python-process finished"

Output

To silence the message "Process python-process finished" in Emacs Lisp, you can set a custom process sentinel that suppresses the message. Here's how:

1
2
3
4
5
6
7
8
9
;; Define a custom sentinel that doesn't display the exit message
(defun silent-process-sentinel (process event)
  "Handle PROCESS EVENT without displaying messages."
  (force-mode-line-update))  ; Optional: Update mode line if needed

;; After starting the Python process, set its sentinel
(let ((proc (get-process "python-process")))  ; Replace "python-process" with your process name
  (when proc
    (set-process-sentinel proc #'silent-process-sentinel)))
**Steps:** 1. **Define a Custom Sentinel:** The function `silent-process-sentinel` replaces the default sentinel. It avoids calling `message`, thus suppressing the exit notification. The `force-mode-line-update` ensures the mode line reflects the process status. 2. **Apply to Your Process:** Replace `"python-process"` with the actual name of your Python process (commonly `"Python"` if using `run-python`). Execute this code after starting the process. **Automation with Advice (Optional):** To automatically apply this whenever you start a Python process:
1
2
3
4
5
6
;; Advise 'run-python' to set the sentinel afterward
(advice-add 'run-python :after
            (lambda (&rest _)
              (let ((proc (get-process "Python")))  ; Default process name for 'run-python'
                (when proc
                  (set-process-sentinel proc #'silent-process-sentinel)))))
This ensures every new Python process uses your silent sentinel. **Note:** If the process name differs in your setup, adjust `get-process` accordingly.

Substring Evaluation

Testing if the previous output contains the string set-process-sentinel: True