@@ -5994,9 +5994,6 @@ alive."
5994
5994
(markdown-live-preview-create-display out-file src-buf)
5995
5995
(markdown-live-preview-async-cleanup-export src-buf msg)))
5996
5996
5997
- (defmacro markdown-silence-messages (&rest body)
5998
- `(cl-letf (((symbol-function #'message) (lambda (&rest _)))) ,@body))
5999
-
6000
5997
(defun markdown-live-preview-do-sentinel (src-buf out-file proc)
6001
5998
(unless (or (process-live-p proc)
6002
5999
(not (buffer-live-p src-buf)))
@@ -6007,44 +6004,53 @@ alive."
6007
6004
src-buf out-file cur-msg))))
6008
6005
6009
6006
(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)))
6012
6008
6013
6009
(defconst markdown-live-preview-proc-name "*markdown-live-preview*")
6014
6010
(defconst markdown-live-preview-buf-name "*markdown-live-preview-output*")
6015
6011
6016
6012
(defun markdown-live-preview-async-export ()
6017
6013
(interactive)
6014
+ (message "start-export")
6018
6015
(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))))
6048
6054
6049
6055
(defvar markdown-live-preview-currently-exporting nil)
6050
6056
0 commit comments