From 0ef2a3566f76e1c03ec64ac64cbb916530e40e32 Mon Sep 17 00:00:00 2001 From: Vincent Zhang Date: Wed, 9 Jun 2021 21:05:58 +0800 Subject: [PATCH] [Feature] New option: grip-preview-host. Close #19. --- README.md | 3 +++ grip-mode.el | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f8e7834..e80e1e6 100644 --- a/README.md +++ b/README.md @@ -94,6 +94,9 @@ Run `M-x customize-group RET grip RET` or set the variables. ;; after every text change (setq grip-update-after-change nil) +;; Preview hostname +(setq grip-preview-host "localhost") + ;; Use embedded webkit to previe ;; This requires GNU/Emacs version >= 26 and built with the `--with-xwidgets` ;; option. diff --git a/grip-mode.el b/grip-mode.el index 682187d..91a589f 100644 --- a/grip-mode.el +++ b/grip-mode.el @@ -83,6 +83,11 @@ When nil, only update the preview on file save." :type 'boolean :group 'grip) +(defcustom grip-preview-host "localhost" + "Preview hostname." + :type 'string + :group 'grip) + (defcustom grip-preview-use-webkit t "Use embedded webkit to preview. @@ -134,7 +139,7 @@ Use default browser unless `xwidget' is available." (defun grip--preview-url () "Return grip preview url." - (format "http://localhost:%d" grip--port)) + (format "http://%s:%d" grip-preview-host grip--port)) (defun grip-start-process () "Render and preview with grip."