|
|
|
@ -1,3 +1,14 @@
|
|
|
|
|
;; variables live here
|
|
|
|
|
|
|
|
|
|
(setq dw-username "tobli")
|
|
|
|
|
(setq dw-pin "0397")
|
|
|
|
|
(setq dw-defaultlocation "🏠")
|
|
|
|
|
(setq dw-iconfile "~/Documents/drive/org/iconchoose.el")
|
|
|
|
|
(setq lastfm-login t) ;; boolean
|
|
|
|
|
(setq lastfm-user "litrovers")
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
|
|
(defun dwexport ()
|
|
|
|
|
(let ((org-export-with-author 'nil)
|
|
|
|
|
(org-export-with-creator 'nil)
|
|
|
|
@ -7,8 +18,8 @@
|
|
|
|
|
(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"))
|
|
|
|
|
(setq oldname (concat (file-name-base) ".org"))
|
|
|
|
|
(setq newname (concat (file-name-base) ".html"))
|
|
|
|
|
(find-file-noselect newname)
|
|
|
|
|
(with-current-buffer newname
|
|
|
|
|
(goto-line 1)
|
|
|
|
@ -53,7 +64,7 @@
|
|
|
|
|
(substring moodjunk 2 end))"\n"))))
|
|
|
|
|
|
|
|
|
|
(defun dwmusic ()
|
|
|
|
|
(setq music (lastfm-user-get-recent-tracks :user "litrovers" :from 1 :to 1))
|
|
|
|
|
(setq music (lastfm-user-get-recent-tracks :user lastfm-user :from 1 :to 1))
|
|
|
|
|
(setq music (replace-regexp-in-string (regexp-quote "\" \"") " – " (format "%S" music) nil 'literal))
|
|
|
|
|
(sleep-for 1)
|
|
|
|
|
(if (not music)
|
|
|
|
@ -68,20 +79,15 @@
|
|
|
|
|
|
|
|
|
|
(defun dwicon (thefile)
|
|
|
|
|
(setq icon "skip")
|
|
|
|
|
(load-file dw-iconfile)
|
|
|
|
|
(with-current-buffer thefile
|
|
|
|
|
(cond
|
|
|
|
|
((string-match-p "\\bbraska\\b" (buffer-substring (point-min) (point-max))) (setq icon "braska"))
|
|
|
|
|
((string-match-p "\\bffx[^-]\\b" (buffer-substring (point-min) (point-max))) (setq icon "ffx"))
|
|
|
|
|
((string-match-p "\\bffx-2\\b" (buffer-substring (point-min) (point-max))) (setq icon "ffx-2"))
|
|
|
|
|
((string-match-p "\\belp\\b" (buffer-substring (point-min) (point-max))) (setq icon "elp"))
|
|
|
|
|
((string-match-p "\\bprog\\b" (buffer-substring (point-min) (point-max))) (setq icon "prog"))
|
|
|
|
|
((string-match-p "\\btarkus\\b" (buffer-substring (point-min) (point-max))) (setq icon "tarkus"))))
|
|
|
|
|
(iconchoose))
|
|
|
|
|
(if (equal icon "skip")
|
|
|
|
|
(sleep-for 0)
|
|
|
|
|
(insert (concat "post-icon: "icon "\n"))))
|
|
|
|
|
|
|
|
|
|
(defun dwlocation ()
|
|
|
|
|
(setq location (read-string "Location: " "🏠"))
|
|
|
|
|
(setq location (read-string "Location: " dw-defaultlocation))
|
|
|
|
|
(if (equal location "")
|
|
|
|
|
(sleep-for 0)
|
|
|
|
|
(insert (concat "post-location: " location "\n"))))
|
|
|
|
@ -96,18 +102,20 @@
|
|
|
|
|
(interactive (list (read-string "Post title (REQUIRED): ")
|
|
|
|
|
(read-string "Tags (comma-separated): ")))
|
|
|
|
|
(dwexport)
|
|
|
|
|
(compose-mail "tobli+0397@post.dreamwidth.org" psubject)
|
|
|
|
|
(with-current-buffer "*unsent mail to tobli*"
|
|
|
|
|
(compose-mail (concat dw-username "+" dw-pin "@post.dreamwidth.org") psubject)
|
|
|
|
|
(with-current-buffer (concat "*unsent mail to " dw-username "*")
|
|
|
|
|
(insert (concat "post-tags: org-export, " tags "\n"))
|
|
|
|
|
(dwsecurity)
|
|
|
|
|
(dwlocation)
|
|
|
|
|
(dwicon newname)
|
|
|
|
|
(cond
|
|
|
|
|
(lastfm-login t (dwmusic))
|
|
|
|
|
((dwmusic-manual)))
|
|
|
|
|
(dwmood)
|
|
|
|
|
(dwmusic)
|
|
|
|
|
(insert (concat "\n"))
|
|
|
|
|
(insert-file-contents newname)
|
|
|
|
|
(message-send-and-exit))
|
|
|
|
|
(kill-buffer newname)
|
|
|
|
|
(kill-buffer "*sent mail to tobli*")
|
|
|
|
|
(kill-buffer (concat "*sent mail to " dw-username "*"))
|
|
|
|
|
(with-current-buffer oldname
|
|
|
|
|
(delete-file newname)))
|
|
|
|
|