@@ -5994,9 +5994,6 @@ alive."
59945994 (markdown-live-preview-create-display out-file src-buf)
59955995 (markdown-live-preview-async-cleanup-export src-buf msg)))
59965996
5997- (defmacro markdown-silence-messages (&rest body)
5998- `(cl-letf (((symbol-function #'message) (lambda (&rest _)))) ,@body))
5999-
60005997(defun markdown-live-preview-do-sentinel (src-buf out-file proc)
60015998 (unless (or (process-live-p proc)
60025999 (not (buffer-live-p src-buf)))
@@ -6007,44 +6004,53 @@ alive."
60076004 src-buf out-file cur-msg))))
60086005
60096006(defun markdown-live-preview-make-async-sentinel (src-buf out-file)
6010- (lambda (proc _)
6011- (markdown-live-preview-do-sentinel src-buf out-file proc)))
6007+ (lambda (proc _) (markdown-live-preview-do-sentinel src-buf out-file proc)))
60126008
60136009(defconst markdown-live-preview-proc-name "*markdown-live-preview*")
60146010(defconst markdown-live-preview-buf-name "*markdown-live-preview-output*")
60156011
60166012(defun markdown-live-preview-async-export ()
60176013 (interactive)
6014+ (message "start-export")
60186015 (unless markdown-live-preview-currently-exporting-process
6019- (markdown-silence-messages
6020- (let* ((cur-buf (current-buffer))
6021- (mode major-mode)
6022- (out-file (markdown-live-preview-get-filename))
6023- (sentinel (markdown-live-preview-make-async-sentinel
6024- cur-buf out-file))
6025- (proc
6026- (start-process-shell-command
6027- markdown-live-preview-proc-name markdown-live-preview-buf-name
6028- ;; using redirection means emacs doesn't have to process output,
6029- ;; which interrupts the user less
6030- (concat
6031- markdown-command
6032- (and markdown-command-needs-filename
6033- (if (buffer-file-name) (buffer-file-name)
6034- (user-error "Must be visiting a file")))
6035- " > " (shell-quote-argument out-file)))))
6036- (setq markdown-live-preview-currently-exporting-process proc)
6037- (set-process-sentinel proc sentinel)
6038- (with-temp-buffer
6039- (let ((tmp-buf (current-buffer)))
6040- (with-current-buffer cur-buf
6041- (copy-to-buffer tmp-buf (point-min) (point-max))))
6042- (funcall mode)
6043- (run-hooks 'markdown-before-export-hook)
6044- (process-send-region proc (point-min) (point-max))
6045- (process-send-eof proc)
6046- (run-hooks 'markdown-after-export-hook)
6047- proc)))))
6016+ (let* ((cur-buf (current-buffer))
6017+ (mode major-mode)
6018+ (out-file (markdown-live-preview-get-filename))
6019+ (sentinel (markdown-live-preview-make-async-sentinel
6020+ cur-buf out-file))
6021+ (proc
6022+ (start-process-shell-command
6023+ markdown-live-preview-proc-name markdown-live-preview-buf-name
6024+ ;; using redirection means emacs doesn't have to process output,
6025+ ;; which interrupts the user less
6026+ (concat
6027+ markdown-command " "
6028+ (and markdown-command-needs-filename
6029+ (if (buffer-file-name)
6030+ (shell-quote-argument (buffer-file-name))
6031+ (user-error "Must be visiting a file")))
6032+ " > " (shell-quote-argument out-file)))))
6033+ (message "start-export2")
6034+ (setq markdown-live-preview-currently-exporting-process proc)
6035+ (set-process-sentinel proc sentinel)
6036+ (message "start-export3")
6037+ (with-temp-buffer
6038+ (message "start-export4")
6039+ (let ((tmp-buf (current-buffer)))
6040+ (with-current-buffer cur-buf
6041+ (copy-to-buffer tmp-buf (point-min) (point-max))))
6042+ (message "start-export5")
6043+ (funcall mode)
6044+ (message "start-export6")
6045+ (run-hooks 'markdown-before-export-hook)
6046+ (message "start-export7")
6047+ (process-send-region proc (point-min) (point-max))
6048+ (message "start-export8")
6049+ (process-send-eof proc)
6050+ (message "start-export9")
6051+ (run-hooks 'markdown-after-export-hook)
6052+ (message "start-export10")
6053+ proc))))
60486054
60496055(defvar markdown-live-preview-currently-exporting nil)
60506056
0 commit comments