Improve dw posting function

master
trémeur 3 years ago
parent 40adaa9565
commit ae5ce879a7

@ -1,13 +1,14 @@
(defun dwpost (psubject) (defun dwpost (psubject tags)
(interactive "MPost title (REQUIRED): ") (interactive "MPost title (REQUIRED): \nMTags (comma-separated): ")
(setq org-export-with-author 'nil) (let ((org-export-with-author 'nil)
(setq org-export-with-creator 'nil) (org-export-with-creator 'nil)
(setq org-export-with-date 'nil) (org-export-with-date 'nil)
(setq org-export-with-section-numbers 'nil) (org-export-with-section-numbers 'nil)
(setq org-export-time-stamp-file 'nil) (org-export-time-stamp-file 'nil)
(setq org-export-with-toc 'nil) (org-export-with-toc 'nil)
(setq org-html-validation-link 'nil) (org-html-validation-link 'nil))
(org-html-export-to-html) (org-html-export-to-html))
(defvar oldname (concat (file-name-base) ".org"))
(defvar newname (concat (file-name-base) ".html")) (defvar newname (concat (file-name-base) ".html"))
(find-file-noselect newname) (find-file-noselect newname)
(with-current-buffer newname (with-current-buffer newname
@ -17,20 +18,24 @@
(kill-buffer newname) (kill-buffer newname)
(compose-mail "tobli+0397@post.dreamwidth.org" psubject) (compose-mail "tobli+0397@post.dreamwidth.org" psubject)
(with-current-buffer "*unsent mail to tobli*" (with-current-buffer "*unsent mail to tobli*"
(insert (concat "post-tags: org-export, "tags "\n\n"))
(insert-file-contents newname) (insert-file-contents newname)
(message-send-and-exit)) (message-send-and-exit))
(kill-buffer "*sent mail to tobli*")) (kill-buffer "*sent mail to tobli*")
(with-current-buffer oldname
(delete-file newname)))
(defun dwpost-public (psubject) (defun dwpost-public (psubject tags)
(interactive "MPost title (REQUIRED): ") (interactive "MPost title (REQUIRED): \nMTags (comma-separated): ")
(setq org-export-with-author 'nil) (let ((org-export-with-author 'nil)
(setq org-export-with-creator 'nil) (org-export-with-creator 'nil)
(setq org-export-with-date 'nil) (org-export-with-date 'nil)
(setq org-export-with-section-numbers 'nil) (org-export-with-section-numbers 'nil)
(setq org-export-time-stamp-file 'nil) (org-export-time-stamp-file 'nil)
(setq org-export-with-toc 'nil) (org-export-with-toc 'nil)
(setq org-html-validation-link 'nil) (org-html-validation-link 'nil))
(org-html-export-to-html) (org-html-export-to-html))
(defvar oldname (concat (file-name-base) ".org"))
(defvar newname (concat (file-name-base) ".html")) (defvar newname (concat (file-name-base) ".html"))
(find-file-noselect newname) (find-file-noselect newname)
(with-current-buffer newname (with-current-buffer newname
@ -40,7 +45,66 @@
(kill-buffer newname) (kill-buffer newname)
(compose-mail "tobli+0397@post.dreamwidth.org" psubject) (compose-mail "tobli+0397@post.dreamwidth.org" psubject)
(with-current-buffer "*unsent mail to tobli*" (with-current-buffer "*unsent mail to tobli*"
(insert "post-security: public\n\n") (insert "post-security: public\n")
(insert (concat "post-tags: org-export, "tags "\n\n"))
(insert-file-contents newname) (insert-file-contents newname)
(message-send-and-exit)) (message-send-and-exit))
(kill-buffer "*sent mail to tobli*")) (kill-buffer "*sent mail to tobli*")
(with-current-buffer oldname
(delete-file newname)))
(defun dwpost-access (psubject tags)
(interactive "MPost title (REQUIRED): \nMTags (comma-separated): ")
(let ((org-export-with-author 'nil)
(org-export-with-creator 'nil)
(org-export-with-date 'nil)
(org-export-with-section-numbers 'nil)
(org-export-time-stamp-file 'nil)
(org-export-with-toc 'nil)
(org-html-validation-link 'nil))
(org-html-export-to-html))
(defvar oldname (concat (file-name-base) ".org"))
(defvar newname (concat (file-name-base) ".html"))
(find-file-noselect newname)
(with-current-buffer newname
(goto-line 1)
(delete-region (line-beginning-position) (line-end-position))
(write-file newname))
(kill-buffer newname)
(compose-mail "tobli+0397@post.dreamwidth.org" psubject)
(with-current-buffer "*unsent mail to tobli*"
(insert "post-security: access\n")
(insert (concat "post-tags: org-export, "tags "\n\n"))
(insert-file-contents newname)
(message-send-and-exit))
(kill-buffer "*sent mail to tobli*")
(with-current-buffer oldname
(delete-file newname)))
(defun dwpost-me (psubject tags)
(interactive "MPost title (REQUIRED): \nMTags (comma-separated): ")
(let ((org-export-with-author 'nil)
(org-export-with-creator 'nil)
(org-export-with-date 'nil)
(org-export-with-section-numbers 'nil)
(org-export-time-stamp-file 'nil)
(org-export-with-toc 'nil)
(org-html-validation-link 'nil))
(org-html-export-to-html))
(defvar oldname (concat (file-name-base) ".org"))
(defvar newname (concat (file-name-base) ".html"))
(find-file-noselect newname)
(with-current-buffer newname
(goto-line 1)
(delete-region (line-beginning-position) (line-end-position))
(write-file newname))
(kill-buffer newname)
(compose-mail "tobli+0397@post.dreamwidth.org" psubject)
(with-current-buffer "*unsent mail to tobli*"
(insert "post-security: private\n")
(insert (concat "post-tags: org-export, "tags "\n\n"))
(insert-file-contents newname)
(message-send-and-exit))
(kill-buffer "*sent mail to tobli*")
(with-current-buffer oldname
(delete-file newname)))

Loading…
Cancel
Save