I'm fairly confident that the outer save-excursion is unnecessary, but I added it in case having the timer run while in the markdown buffer was causing problems. This behavior happens regardless of whether the current buffer is the markdown buffer or some other buffer when the timer runs. My understanding is that (save-excursion -anything-) should leave the current buffer and the point in that buffer unchanged. So it appears that (save-excursion (markdown-export)) is moving the point in the current buffer. Saving file /Users/me/partial-matching-components/partial-matching.md.ġ - After Point in partial-matching.md: 1404Ģ - After Point in partial-matching.md: 1ģ - After Point in partial-matching.md: 1 Saving file /Users/me/partial-matching.html. The content of the *Messages* buffer is 3 Point in partial-matching.md: 1404 However, if the buffer has changes, the point jumps to the beginning of the buffer. This works if there are no changes to save. (message "3 - After Point in %s: %s" (current-buffer) (point)) (message "2 - After Point in %s: %s" (current-buffer) (point)) (message "1 - After Point in %s: %s" (current-buffer) (point)) (message "1 Point in %s: %s" (current-buffer) (point)) (message "2 Point in %s: %s" (current-buffer) (point)) (message "3 Point in %s: %s" (current-buffer) (point)) (loop for buffer in my-markdown-idle-buffers (add-to-list 'my-markdown-idle-buffers (current-buffer))) (setq my-markdown-idle-timer (run-with-idle-timer 2 'repeat 'my-markdown-idle-export))) "Export the file whenever emacs is idle." I tried to do the following: (defvar my-markdown-idle-timer nil) (I have the output loaded in a Chrome tab which is auto-reloading.) Wkhtmltopdf -header-html header.html -footer-html footer.html browser-output-fixed-toc.html paper.I am trying to write an idle-timer to export my markdown file whenever I am idle. Run the ruby script fix-toc.rb, which takes the toc.xml and browser-output.html and fixes the page numbers in the table of content and saves it as a new file named browser-output-fixed-toc.html. This is importent! You don't just want the source code but rather the rendered HTML source code and save it as browser-output.html in the same directory. Safari) and copy the rendered HTML output. Open the newly created paper.html in your favourite browser (e.g. This will generate two files: toc.xml (which contains the table of contents of all the H1, H2, H3. Wkhtmltopdf -dump-outline toc.xml -header-html header.html -footer-html footer.html paper.html paper.pdf How to create your paper from Markdown (manually)Įxport HTML to paper.html including styles and syntax highlightingįrom the command line, run the following command:
0 Comments
Leave a Reply. |