start mu4e through shell

This commit is contained in:
Samvid Mistry 2023-11-01 13:59:57 +05:30
parent e4ac3f205d
commit 15d4f23e34
1 changed files with 21 additions and 19 deletions

View File

@ -432,25 +432,27 @@ You cannot run the repl when mu4e is running (or vice-versa)."
(message "invoked: '%s'" cmd))))) (message "invoked: '%s'" cmd)))))
(defun mu4e--server-start () (defun mu4e--server-start ()
"Start the mu server process." "Start the mu server process."
(mu4e--version-check) (mu4e--version-check)
;; kill old/stale servers, if any. ;; kill old/stale servers, if any.
(mu4e--kill-stale) (mu4e--kill-stale)
(let* ((process-connection-type nil) ;; use a pipe (let* ((process-connection-type nil) ;; use a pipe
(args (mu4e--server-args))) (args (mu4e--server-args)))
(setq mu4e--server-buf "") (setq mu4e--server-buf "")
(mu4e-log 'misc "* invoking '%s' with parameters %s" mu4e-mu-binary (mu4e-log 'misc "* invoking '%s' with parameters %s" mu4e-mu-binary
(mapconcat (lambda (arg) (format "'%s'" arg)) args " ")) (mapconcat (lambda (arg) (format "'%s'" arg)) args " "))
(setq mu4e--server-process (apply 'start-process (setq mu4e--server-process ;; (apply 'start-process
mu4e--server-name mu4e--server-name ;; mu4e--server-name mu4e--server-name
mu4e-mu-binary args)) ;; mu4e-mu-binary args)
;; register a function for (:info ...) sexps (start-process-shell-command mu4e--server-name mu4e--server-name (concat mu4e-mu-binary " " (mapconcat 'identity args " ")))
(unless mu4e--server-process )
(mu4e-error "Failed to start the mu4e backend")) ;; register a function for (:info ...) sexps
(set-process-query-on-exit-flag mu4e--server-process nil) (unless mu4e--server-process
(set-process-coding-system mu4e--server-process 'binary 'utf-8-unix) (mu4e-error "Failed to start the mu4e backend"))
(set-process-filter mu4e--server-process 'mu4e--server-filter) (set-process-query-on-exit-flag mu4e--server-process nil)
(set-process-sentinel mu4e--server-process 'mu4e--server-sentinel))) (set-process-coding-system mu4e--server-process 'binary 'utf-8-unix)
(set-process-filter mu4e--server-process 'mu4e--server-filter)
(set-process-sentinel mu4e--server-process 'mu4e--server-sentinel)))
(defun mu4e--server-kill () (defun mu4e--server-kill ()
"Kill the mu server process." "Kill the mu server process."