Skip to content

why re-read from init-buf-string in markdown-export? #55

Closed
@cosmicexplorer

Description

@cosmicexplorer

I'm puzzling over some of the code in markdown-export. After running markdown-after-export-hook, if the buffer is modified by any of the hooks or markdown-standalone, it is re-read from that initial state init-buf-string. Why is that? snip here:

      (run-hooks 'markdown-before-export-hook)
      (markdown-standalone output-buffer-name)
      (with-current-buffer output-buffer
        (run-hooks 'markdown-after-export-hook)
        (save-buffer))
      ;; if modified, restore initial buffer
      (when (buffer-modified-p init-buf)
        (erase-buffer)
        (insert init-buf-string)
        (save-buffer)
        (goto-char init-point))

Is there any reason why this is happening? It doesn't seem to affect anything normally, but I'm working on an asynchronous-export feature for fun (#56) and this erases any input the user has entered from the time export begins to the time the process ends.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions