From 41e2c391732f7d69dcc75fc28e2058bbc6bf1f63 Mon Sep 17 00:00:00 2001 From: Alexis Purslane Date: Sun, 21 Jul 2024 19:06:12 -0400 Subject: [PATCH] dir-local org-static-blog variables, such as the location of the publish directory, are not preserved when the temp-buffer is switched to, so we must store them beforehand. --- org-static-blog.el | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/org-static-blog.el b/org-static-blog.el index 05e223d..6c3c288 100644 --- a/org-static-blog.el +++ b/org-static-blog.el @@ -617,26 +617,27 @@ Preamble and Postamble are excluded, too." Preamble and Postamble are excluded, too." ;; NB! The following code assumes the post is using default template. ;; See: org-static-blog-publish-file - (with-temp-buffer - (insert-file-contents (org-static-blog-matching-publish-filename post-filename)) - (buffer-substring-no-properties - (progn - (goto-char (point-min)) - (if exclude-title - (progn (search-forward "

") - (search-forward "

")) - (search-forward "
")) - (point)) - (progn - (goto-char (point-max)) - ;; Search backward for the post content (by org-static-blog-render-post-content). - ;; See: org-static-blog-template - (search-backward "
") - (search-backward "
") - ;; If comments section exists, it is then one div backward. - ;; See: org-static-blog-post-postamble - (search-backward "
" nil t) - (point))))) + (let ((publish-filename (org-static-blog-matching-publish-filename post-filename))) + (with-temp-buffer + (insert-file-contents publish-filename) + (buffer-substring-no-properties + (progn + (goto-char (point-min)) + (if exclude-title + (progn (search-forward "

") + (search-forward "

")) + (search-forward "
")) + (point)) + (progn + (goto-char (point-max)) + ;; Search backward for the post content (by org-static-blog-render-post-content). + ;; See: org-static-blog-template + (search-backward "
") + (search-backward "
") + ;; If comments section exists, it is then one div backward. + ;; See: org-static-blog-post-postamble + (search-backward "
" nil t) + (point)))))) (defun org-static-blog-get-absolute-url (relative-url) "Returns absolute URL based on the RELATIVE-URL passed to the function.