From 0c024848f91a9ca1aad8e4a0bd651091feb3608a Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sat, 13 Jun 2026 13:02:46 -0500 Subject: 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. --- modules/markdown-config.el | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'modules') 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 - ("" . markdown-preview)) ;; use same key as compile for consistency + ("" . 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) -- cgit v1.2.3