aboutsummaryrefslogtreecommitdiff
path: root/modules
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
commit0c024848f91a9ca1aad8e4a0bd651091feb3608a (patch)
treea8da3545bd8f08b699d25176c484e3d9c64863d0 /modules
parent2427916c7fb1b65b89b9a3200d067413c85f94e8 (diff)
downloaddotemacs-0c024848f91a9ca1aad8e4a0bd651091feb3608a.tar.gz
dotemacs-0c024848f91a9ca1aad8e4a0bd651091feb3608a.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')
-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 4faa4474..16935425 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)