aboutsummaryrefslogtreecommitdiff
path: root/modules/markdown-config.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-06-13 13:02:46 -0500
committerCraig Jennings <c@cjennings.net>2026-06-13 13:02:46 -0500
commit8e70b8e07126bd5e6c4ad470f38b83e29cdc8108 (patch)
treeb59b65d4a50655f5bc38853b18d060f759435837 /modules/markdown-config.el
parenta2df36e8c6676353309d68f66d17c46130163e77 (diff)
downloaddotemacs-8e70b8e07126bd5e6c4ad470f38b83e29cdc8108.tar.gz
dotemacs-8e70b8e07126bd5e6c4ad470f38b83e29cdc8108.zip
fix(markdown): restore the live preview (rename, guard, dead setq)
F2 ran markdown-mode's own markdown-preview instead of the custom one, so the impatient-mode strapdown preview was dead. I renamed the custom command to cj/markdown-preview and rebound F2 so markdown-mode no longer shadows it. The server guard now uses httpd-running-p (httpd-process isn't a variable), and a dead (setq imp-set-user-filter 'markdown-html) that named neither a real variable nor a real filter is gone.
Diffstat (limited to 'modules/markdown-config.el')
-rw-r--r--modules/markdown-config.el10
1 files changed, 4 insertions, 6 deletions
diff --git a/modules/markdown-config.el b/modules/markdown-config.el
index 4faa4474e..16935425d 100644
--- a/modules/markdown-config.el
+++ b/modules/markdown-config.el
@@ -21,7 +21,7 @@
("\\.md\\'" . markdown-mode)
("\\.markdown\\'" . markdown-mode))
:bind (:map markdown-mode-map
- ("<f2>" . markdown-preview)) ;; use same key as compile for consistency
+ ("<f2>" . cj/markdown-preview)) ;; use same key as compile for consistency
:init (setq markdown-command "multimarkdown"))
;; Register markdown as a known org-src-block language so `org-lint'
@@ -36,9 +36,7 @@
;; allows for live previews of your html
;; see: https://github.com/skeeto/impatient-mode
(use-package impatient-mode
- :defer t
- :config
- (setq imp-set-user-filter 'markdown-html))
+ :defer t)
;;;; --------------------- WIP: Markdown-Preview ---------------------
@@ -51,14 +49,14 @@ Idempotent: re-running while the server is already up is a no-op."
(message "markdown preview server running on http://localhost:8080/imp"))
;; the filter to apply to markdown before impatient-mode pushes it to the server
-(defun markdown-preview ()
+(defun cj/markdown-preview ()
"Open the current buffer as a live HTML preview at http://localhost:8080/imp.
The simple-httpd listener must already be running -- see
`cj/markdown-preview-server-start'. Starting a network listener as a
side effect of opening a preview is surprising, so the server start
lives in a separate command."
(interactive)
- (unless (and (boundp 'httpd-process) httpd-process)
+ (unless (httpd-running-p)
(user-error "markdown preview server not running; run `M-x cj/markdown-preview-server-start' first"))
(impatient-mode 1)
(setq imp-user-filter #'cj/markdown-html)