Automatically kill stale mu servers

master
Jacopo De Simoi 3 years ago
parent c72d070f23
commit c0b4103021
  1. 27
      global.org

@ -958,7 +958,32 @@
(propertize (format "\u200B[%d]" num)
'face 'mu4e-url-number-face))))))))))
#+end_src
This one kills servers attached to mu4e instances in other
activities
#+begin_src emacs-lisp
(defun mu4e--server-sentinel (proc _msg)
"Function called when the server process PROC terminates with MSG."
(let ((status (process-status proc)) (code (process-exit-status proc)))
(setq mu4e--server-process nil)
(setq mu4e--server-buf "") ;; clear any half-received sexps
(cond
((eq status 'signal)
(cond
((or(eq code 9) (eq code 2)) (message nil))
;;(message "the mu server process has been stopped"))
(t (error (format "mu server process received signal %d" code)))))
((eq status 'exit)
(cond
((eq code 0)
(message nil)) ;; don't do anything
((eq code 19)
(when (string-equal (kde-current-activity-name) server-name)
(start-process "killer" nil "killall" "mu"))
(error "Database is locked by another process; try again"))
(t (error "Mu server process ended with exit code %d" code))))
(t
(error "Something bad happened to the mu server process")))))
#+end_src
** org-mode
*** Require
Require the ~org~ package; I also occasionally use org-pomodoro

Loading…
Cancel
Save