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 "Process python-process finished" message in Emacs Lisp, you can use the following code:

1
(advice-add 'python-mode :after (lambda () (set-process-query-on-exit-flag (get-process "python-process") nil)))
However, this will only work if you're using the `python-mode` provided by Emacs. If you're using a different Python mode, you'll need to adjust the code accordingly. Alternatively, you can use the following code to silence the message for all processes:
1
(setq kill-buffer-query-functions (remq 'process-kill-buffer-query-function kill-buffer-query-functions))
This will remove the `process-kill-buffer-query-function` from the list of functions that are called when a buffer is killed, which is responsible for displaying the message. If you want to silence the message only for the Python process, you can use the following code:
1
2
3
4
5
(defadvice kill-process (around silence-python-process-query activate)
  (let ((process (ad-get-arg 0)))
    (if (string= (process-name process) "python-process")
        (setq ad-return-value (kill-process process t))
      ad-do-it)))
This will advise the `kill-process` function to silently kill the Python process without displaying the message. Note: The above code uses the `defadvice` macro, which is deprecated in Emacs 24.4 and later. If you're using a newer version of Emacs, you can use the `advice-add` function instead:
1
2
3
4
5
6
(advice-add 'kill-process :around #'silence-python-process-query)
(defun silence-python-process-query (orig-fn &rest args)
  (let ((process (car args)))
    (if (string= (process-name process) "python-process")
        (apply orig-fn args t)
      (apply orig-fn args))))

Substring Evaluation

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