[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/kiwix 57b07c1 3/6: To enable stopping local server, ke
From: |
Stefan Monnier |
Subject: |
[elpa] externals/kiwix 57b07c1 3/6: To enable stopping local server, keep a reference to server process |
Date: |
Thu, 7 Oct 2021 08:33:51 -0400 (EDT) |
branch: externals/kiwix
commit 57b07c1d80a8a2825794f349741158bd26cbabe6
Author: Matt Beshara <m@mfa.pw>
Commit: Matt Beshara <m@mfa.pw>
To enable stopping local server, keep a reference to server process
---
kiwix.el | 24 +++++++++++++++++-------
1 file changed, 17 insertions(+), 7 deletions(-)
diff --git a/kiwix.el b/kiwix.el
index a97f43c..70eacc4 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -216,6 +216,8 @@ Set it to ‘t’ will use Emacs built-in ‘completing-read’."
"Specify kiwix-mode keybinding prefix before loading."
:type 'kbd)
+(defvar kiwix--server-process nil
+ "Local server process launched by ‘kiwix-launch-server’.")
;; launch Kiwix server
;;;###autoload
@@ -236,13 +238,21 @@ Set it to ‘t’ will use Emacs built-in ‘completing-read’."
"-p" (format "%s:80" kiwix-server-port)
"kiwix/kiwix-serve"
"--library" "library.xml"))
- ('kiwix-serve-local (start-process
- "kiwix-server"
- " *kiwix server*"
- kiwix-server-command
- "--port" (number-to-string kiwix-server-port)
- "--daemon"
- "--library" (concat library-path "library.xml"))))))
+ ('kiwix-serve-local
+ (setq kiwix--server-process
+ (start-process
+ "kiwix-server"
+ " *kiwix server*"
+ kiwix-server-command
+ "--port" (number-to-string kiwix-server-port)
+ "--library" (concat kiwix-zim-dir "library.xml")))))))
+
+(defun kiwix-stop-local-server ()
+ "Stops a Kiwix server started by ‘kiwix-launch-server’."
+ (interactive)
+ (when kiwix--server-process
+ (kill-process kiwix--server-process)
+ (setq kiwix--server-process nil)))
(defun kiwix-capitalize-first (string)
"Only capitalize the first word of STRING."
- [elpa] externals/kiwix updated (7d6039f -> 6191d43), Stefan Monnier, 2021/10/07
- [elpa] externals/kiwix 0a048c1 2/6: Use correct variable name in ‘kiwix-launch-server’, Stefan Monnier, 2021/10/07
- [elpa] externals/kiwix 2cafd37 4/6: I think I was wrong: ‘kiwix-zim-dir’ is distinct from ‘library-path’, Stefan Monnier, 2021/10/07
- [elpa] externals/kiwix 6439f32 1/6: Add a note that ‘kiwix-zim-dir’ must end with a slash, Stefan Monnier, 2021/10/07
- [elpa] externals/kiwix 6191d43 6/6: Merge pull request #7 from mattbeshara/launch-server-improvements, Stefan Monnier, 2021/10/07
- [elpa] externals/kiwix 57b07c1 3/6: To enable stopping local server, keep a reference to server process,
Stefan Monnier <=
- [elpa] externals/kiwix acb1301 5/6: There should be a slash between ‘kiwix-zim-dir’ ‘library.xml’, Stefan Monnier, 2021/10/07