Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

don't add global hooks for live-preview #63

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions markdown-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -5314,7 +5314,9 @@ the rendered output."
(let ((output-buffer
(funcall markdown-live-preview-window-function export-file)))
(with-current-buffer output-buffer
(setq markdown-live-preview-source-buffer cur-buf))
(setq markdown-live-preview-source-buffer cur-buf)
(add-hook 'kill-buffer-hook
#'markdown-live-preview-remove-on-kill t t))
(with-current-buffer cur-buf
(setq markdown-live-preview-buffer output-buffer))))
(with-current-buffer cur-buf
Expand Down Expand Up @@ -5910,6 +5912,10 @@ before regenerating font-lock rules for extensions."
(add-hook 'window-configuration-change-hook
'markdown-fontify-buffer-wiki-links t t)

;; add live preview export hook
(add-hook 'after-save-hook #'markdown-live-preview-if-markdown t t)
(add-hook 'kill-buffer-hook #'markdown-live-preview-remove-on-kill t t)

;; do the initial link fontification
(markdown-fontify-buffer-wiki-links))

Expand Down Expand Up @@ -5956,9 +5962,6 @@ before regenerating font-lock rules for extensions."
(markdown-display-buffer-other-window (markdown-live-preview-export))
(markdown-live-preview-remove)))

(add-hook 'after-save-hook #'markdown-live-preview-if-markdown)
(add-hook 'kill-buffer-hook #'markdown-live-preview-remove-on-kill)


(provide 'markdown-mode)
;; Local Variables:
Expand Down