From 8e2f68f4adc1d28c53994cda8a3f914ca43442ea Mon Sep 17 00:00:00 2001 From: Samvid Mistry Date: Sat, 20 Jan 2024 18:43:45 +0530 Subject: [PATCH 1/6] Relax binary checks --- mu4e/mu4e-server.el | 2 +- mu4e/mu4e.el | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mu4e/mu4e-server.el b/mu4e/mu4e-server.el index 5429717c..8c516218 100644 --- a/mu4e/mu4e-server.el +++ b/mu4e/mu4e-server.el @@ -436,7 +436,7 @@ As per issue #2198." (defun mu4e--version-check () ;; sanity-check 1 (let ((default-directory temporary-file-directory)) ;;ensure it's local. - (unless (and mu4e-mu-binary (file-executable-p mu4e-mu-binary)) + (unless mu4e-mu-binary (mu4e-error "Cannot find mu, please set `mu4e-mu-binary' to the mu executable path")) ;; sanity-check 2 diff --git a/mu4e/mu4e.el b/mu4e/mu4e.el index d202a3ce..ffabbb5d 100644 --- a/mu4e/mu4e.el +++ b/mu4e/mu4e.el @@ -94,7 +94,7 @@ Otherwise, completely quit mu4e, including automatic updating." (unless (string= (mu4e-server-version) mu4e-mu-version) (mu4e-error "The mu server has version %s, but we need %s" (mu4e-server-version) mu4e-mu-version))) - (unless (and mu4e-mu-binary (file-executable-p mu4e-mu-binary)) + (unless mu4e-mu-binary (mu4e-error "Please set `mu4e-mu-binary' to the full path to the mu binary")) (dolist (var '(mu4e-sent-folder mu4e-drafts-folder From 4c1f7327c36f5a3a2b606334d6515b78f3dadf4c Mon Sep 17 00:00:00 2001 From: Samvid Mistry Date: Sat, 20 Jan 2024 18:44:45 +0530 Subject: [PATCH 2/6] Start shell process instead of executable --- mu4e/mu4e-server.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mu4e/mu4e-server.el b/mu4e/mu4e-server.el index 8c516218..bbf61c38 100644 --- a/mu4e/mu4e-server.el +++ b/mu4e/mu4e-server.el @@ -480,9 +480,9 @@ You cannot run the repl when mu4e is running (or vice-versa)." (setq mu4e--server-buf "") (mu4e-log 'misc "* invoking '%s' with parameters %s" mu4e-mu-binary (mapconcat (lambda (arg) (format "'%s'" arg)) args " ")) - (setq mu4e--server-process (apply 'start-process - mu4e--server-name mu4e--server-name - mu4e-mu-binary args)) + (setq mu4e--server-process (start-process-shell-command + mu4e--server-name mu4e--server-name + (concat mu4e-mu-binary " " (mapconcat 'identity args " ")))) ;; register a function for (:info ...) sexps (unless mu4e--server-process (mu4e-error "Failed to start the mu4e backend")) From ef83f8d6cd976a8263234554dbd9d0236954346b Mon Sep 17 00:00:00 2001 From: Samvid Mistry Date: Sat, 10 Feb 2024 14:53:03 +0530 Subject: [PATCH 3/6] shell-quote-argument instead of identity --- mu4e/mu4e-server.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mu4e/mu4e-server.el b/mu4e/mu4e-server.el index bbf61c38..f9e185d1 100644 --- a/mu4e/mu4e-server.el +++ b/mu4e/mu4e-server.el @@ -482,7 +482,7 @@ You cannot run the repl when mu4e is running (or vice-versa)." (mapconcat (lambda (arg) (format "'%s'" arg)) args " ")) (setq mu4e--server-process (start-process-shell-command mu4e--server-name mu4e--server-name - (concat mu4e-mu-binary " " (mapconcat 'identity args " ")))) + (concat mu4e-mu-binary " " (mapconcat #'shell-quote-argument args " ")))) ;; register a function for (:info ...) sexps (unless mu4e--server-process (mu4e-error "Failed to start the mu4e backend")) From 8c5427d527cbd774e02e3267e3a8fa9c89296d36 Mon Sep 17 00:00:00 2001 From: Samvid Mistry Date: Sat, 10 Feb 2024 15:04:27 +0530 Subject: [PATCH 4/6] steps for windows setup --- README.org | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.org b/README.org index cf196b64..7302749e 100644 --- a/README.org +++ b/README.org @@ -98,3 +98,16 @@ $ meson setup -C build $ meson compile -C build $ meson install -C build #+end_example + +** Windows + +It is possible to make ~mu4e~ on Windows communicate with ~mu~ running in WSL, +side-stepping the issue of compiling ~mu~ on windows. Assuming you have installed +~mu~ in WSL and added to ~$PATH~, here's a sample configuration. + +#+begin_src emacs-lisp +(use-package mu4e + :load-path "//wsl.localhost/path/to/mu4e" + :config + (setq mu4e-mu-binary "wsl mu")) +#+end_src From 7e161462d8efa1ac74eb81b87b976087a38dba2e Mon Sep 17 00:00:00 2001 From: Samvid Mistry Date: Sat, 10 Feb 2024 15:10:25 +0530 Subject: [PATCH 5/6] updated readme --- README.org | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.org b/README.org index 7302749e..d2855d91 100644 --- a/README.org +++ b/README.org @@ -107,7 +107,10 @@ side-stepping the issue of compiling ~mu~ on windows. Assuming you have installe #+begin_src emacs-lisp (use-package mu4e - :load-path "//wsl.localhost/path/to/mu4e" + :load-path "//wsl.localhost/Ubuntu/path/to/mu4e" :config (setq mu4e-mu-binary "wsl mu")) #+end_src + +Launching ~mu4e~ from any buffer under ~//wsl.localhost/Ubuntu~ should work then. +For more information on why this works, look at [[this PR][https://github.com/djcb/mu/pull/2624]]. From 9a7ed2a5abc783ab9433e6ffb854956f217055c2 Mon Sep 17 00:00:00 2001 From: Samvid Mistry Date: Sat, 10 Feb 2024 15:12:27 +0530 Subject: [PATCH 6/6] fix link --- README.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.org b/README.org index d2855d91..dfd4e4a0 100644 --- a/README.org +++ b/README.org @@ -113,4 +113,4 @@ side-stepping the issue of compiling ~mu~ on windows. Assuming you have installe #+end_src Launching ~mu4e~ from any buffer under ~//wsl.localhost/Ubuntu~ should work then. -For more information on why this works, look at [[this PR][https://github.com/djcb/mu/pull/2624]]. +For more information on why this works, look at [[https://github.com/djcb/mu/pull/2624][this PR]].