Add Android functionality

master
trémeur 2 years ago
parent cd9c277a69
commit 0c96e9885c

File diff suppressed because it is too large Load Diff

@ -41,101 +41,109 @@
(with-current-buffer oldname (with-current-buffer oldname
(delete-file newname))) (delete-file newname)))
(defun dwsecurity () (unless (string-equal system-type "android")
"Set security level for DW post" (defun dwsecurity ()
(setq security (completing-read-multiple "Security (public, access, private): " '("public" "access" "private"))) "Set security level for DW post"
(if (not security) (setq security (completing-read-multiple "Security (public, access, private): " '("public" "access" "private")))
(setq security "skip")) (if (not security)
(if (equal security "skip") (setq security "skip"))
(sleep-for 0) (if (equal security "skip")
(sleep-for 0)
(insert (concat "post-security: " (insert (concat "post-security: "
(let* ((securityjunk (let* ((securityjunk
(format "%S" security)) (format "%S" security))
(end (- (length securityjunk) 2))) (end (- (length securityjunk) 2)))
(substring securityjunk 2 end))"\n")))) (substring securityjunk 2 end))"\n")))))
(defun dwmood () (unless (string-equal system-type "android")
"Set mood for DW post" (defun dwmood ()
(setq mood (completing-read-multiple "Mood: " '("accomplished" "aggravated" "amused" "angry" "annoyed" "anxious" "apathetic" "artistic" "awake" "bitchy" "blah" "blank" "bored" "bouncy" "busy" "calm" "cheerful" "chipper" "cold" "complacent" "confused" "contemplative" "content" "cranky" "crappy" "crazy" "creative" "crushed" "curious" "cynical" "depressed" "determined" "devious" "dirty" "disappointed" "discontent" "distressed" "ditzy" "dorky" "drained" "drunk" "ecstatic" "embarrassed" "energetic" "enraged" "enthralled" "envious" "exanimate" "excited" "exhausted" "flirty" "frustrated" "full" "geeky" "giddy" "giggly" "gloomy" "good" "grateful" "groggy" "grumpy" "guilty" "happy" "high" "hopeful" "horny" "hot" "hungry" "hyper" "impressed" "indescribable" "indifferent" "infuriated" "intimidated" "irate" "irritated" "jealous" "jubilant" "lazy" "lethargic" "listless" "lonely" "loved" "melancholy" "mellow" "mischievous" "moody" "morose" "naughty" "nauseated" "nerdy" "nervous" "nostalgic" "numb" "okay" "optimistic" "peaceful" "pensive" "pessimistic" "pissed off" "pleased" "predatory" "productive" "quixotic" "recumbent" "refreshed" "rejected" "rejuvenated" "relaxed" "relieved" "restless" "rushed" "sad" "satisfied" "scared" "shocked" "sick" "silly" "sleepy" "sore" "stressed" "surprised" "sympathetic" "thankful" "thirsty" "thoughtful" "tired" "touched" "uncomfortable" "weird" "working" "worried"))) "Set mood for DW post"
(if (not mood) (setq mood (completing-read-multiple "Mood: " '("accomplished" "aggravated" "amused" "angry" "annoyed" "anxious" "apathetic" "artistic" "awake" "bitchy" "blah" "blank" "bored" "bouncy" "busy" "calm" "cheerful" "chipper" "cold" "complacent" "confused" "contemplative" "content" "cranky" "crappy" "crazy" "creative" "crushed" "curious" "cynical" "depressed" "determined" "devious" "dirty" "disappointed" "discontent" "distressed" "ditzy" "dorky" "drained" "drunk" "ecstatic" "embarrassed" "energetic" "enraged" "enthralled" "envious" "exanimate" "excited" "exhausted" "flirty" "frustrated" "full" "geeky" "giddy" "giggly" "gloomy" "good" "grateful" "groggy" "grumpy" "guilty" "happy" "high" "hopeful" "horny" "hot" "hungry" "hyper" "impressed" "indescribable" "indifferent" "infuriated" "intimidated" "irate" "irritated" "jealous" "jubilant" "lazy" "lethargic" "listless" "lonely" "loved" "melancholy" "mellow" "mischievous" "moody" "morose" "naughty" "nauseated" "nerdy" "nervous" "nostalgic" "numb" "okay" "optimistic" "peaceful" "pensive" "pessimistic" "pissed off" "pleased" "predatory" "productive" "quixotic" "recumbent" "refreshed" "rejected" "rejuvenated" "relaxed" "relieved" "restless" "rushed" "sad" "satisfied" "scared" "shocked" "sick" "silly" "sleepy" "sore" "stressed" "surprised" "sympathetic" "thankful" "thirsty" "thoughtful" "tired" "touched" "uncomfortable" "weird" "working" "worried")))
(setq mood "skip")) (if (not mood)
(if (equal mood "skip") (setq mood "skip"))
(sleep-for 0) (if (equal mood "skip")
(sleep-for 0)
(insert (concat "post-mood: " (insert (concat "post-mood: "
(let* ((moodjunk (let* ((moodjunk
(format "%S" mood)) (format "%S" mood))
(end (- (length moodjunk) 2))) (end (- (length moodjunk) 2)))
(substring moodjunk 2 end))"\n")))) (substring moodjunk 2 end))"\n")))))
(defun dwmusic () (unless (string-equal system-type "android")
"Set current music for DW post" (defun dwmusic ()
(setq music (lastfm-user-get-recent-tracks :user lastfm-user :from 1 :to 1)) "Set current music for DW post"
(setq music (replace-regexp-in-string (regexp-quote "\" \"") " " (format "%S" music) nil 'literal)) (setq music (lastfm-user-get-recent-tracks :user lastfm-user :from 1 :to 1))
(sleep-for 1) (setq music (replace-regexp-in-string (regexp-quote "\" \"") " " (format "%S" music) nil 'literal))
(if (not music) (sleep-for 1)
(setq music "nil")) (if (not music)
(if (equal music "nil") (setq music "nil"))
(sleep-for 0) (if (equal music "nil")
(insert (concat "post-music: " (sleep-for 0)
(let* ((musicjunk (insert (concat "post-music: "
(format "%S" music)) (let* ((musicjunk
(end (- (length musicjunk) 4))) (format "%S" music))
(substring musicjunk 4 end))"\n")))) (end (- (length musicjunk) 4)))
(substring musicjunk 4 end))"\n")))))
(defun dwicon (thefile) (unless (string-equal system-type "android")
"Set icon for DW post" (defun dwicon (thefile)
(setq icon "skip") "Set icon for DW post"
(load-file dw-iconfile) (setq icon "skip")
(with-current-buffer thefile (load-file dw-iconfile)
(iconchoose)) (with-current-buffer thefile
(if (equal icon "skip") (iconchoose))
(sleep-for 0) (if (equal icon "skip")
(insert (concat "post-icon: "icon "\n")))) (sleep-for 0)
(insert (concat "post-icon: "icon "\n")))))
(defun dwlocation () (unless (string-equal system-type "android")
"Set location for DW post" (defun dwlocation ()
(setq location (read-string "Location: " dw-defaultlocation)) "Set location for DW post"
(if (equal location "") (setq location (read-string "Location: " dw-defaultlocation))
(sleep-for 0) (if (equal location "")
(insert (concat "post-location: " location "\n")))) (sleep-for 0)
(insert (concat "post-location: " location "\n")))))
(defun dwmusic-manual () (unless (string-equal system-type "android")
"Set current music for DW post if lastfm.el not set up" (defun dwmusic-manual ()
(setq music (read-string "Music: ")) "Set current music for DW post if lastfm.el not set up"
(if (equal music "") (setq music (read-string "Music: "))
(sleep-for 0) (if (equal music "")
(insert (concat "post-music: " music "\n")))) (sleep-for 0)
(insert (concat "post-music: " music "\n")))))
(defun dw-posted () (unless (string-equal system-type "android")
"Log DW post" (defun dw-posted ()
(find-file-noselect "~/Documents/drive/org/calendar/habit.org") "Log DW post"
(with-current-buffer "habit.org" (find-file-noselect "~/Documents/drive/org/calendar/habit.org")
(goto-char (point-min)) (with-current-buffer "habit.org"
(re-search-forward "RECUR dw posts") (goto-char (point-min))
(org-shiftright) (re-search-forward "RECUR dw posts")
(sleep-for 1) (org-shiftright)
(save-buffer))) (sleep-for 4)
(save-buffer))))
(defun dwpost (psubject tags) (unless (string-equal system-type "android")
"Post to DW" (defun dwpost (psubject tags)
(interactive (list (read-string "Post title (REQUIRED): ") "Post to DW"
(read-string "Tags (comma-separated): "))) (interactive (list (read-string "Post title (REQUIRED): ")
(dwexport) (read-string "Tags (comma-separated): ")))
(compose-mail (concat dw-username "+" dw-pin "@post.dreamwidth.org") psubject) (dwexport)
(with-current-buffer (concat "*unsent mail to " dw-username "*") (compose-mail (concat dw-username "+" dw-pin "@post.dreamwidth.org") psubject)
(insert (concat "post-tags: org-export, " tags "\n")) (with-current-buffer (concat "*unsent mail to " dw-username "*")
(dwsecurity) (insert (concat "post-tags: org-export, " tags "\n"))
(dwlocation) (dwsecurity)
(dwicon newname) (dwlocation)
(cond (dwicon newname)
(lastfm-login t (dwmusic)) (cond
((dwmusic-manual))) (lastfm-login t (dwmusic))
(dwmood) ((dwmusic-manual)))
(insert (concat "\n")) (dwmood)
(insert-file-contents newname) (insert (concat "\n"))
(message-send-and-exit)) (insert-file-contents newname)
(kill-buffer newname) (message-send-and-exit))
(kill-buffer (concat "*sent mail to " dw-username "*")) (kill-buffer newname)
(with-current-buffer oldname (kill-buffer (concat "*sent mail to " dw-username "*"))
(delete-file newname)) (with-current-buffer oldname
(dw-posted)) (delete-file newname))
(dw-posted)))

@ -44,199 +44,200 @@
(with-current-buffer oldname (with-current-buffer oldname
(delete-file newname))) (delete-file newname)))
(defun fic-export () (unless (string-equal system-type "android")
"Export fic to HTML, EPUB, PDF" (defun fic-export ()
(interactive) "Export fic to HTML, EPUB, PDF"
(shell-command "cp ~/.emacs.d/fic-export-files/FFXYevon.ttf .") (interactive)
(setq asal (y-or-n-p "ASAL?")) (shell-command "cp ~/.emacs.d/fic-export-files/FFXYevon.ttf .")
(if asal (setq asal (y-or-n-p "ASAL?"))
(if asal
(progn
(setq title t)
(setq multichapter t)
(setq chaptertitles nil)
(setq ffx t))
(progn (progn
(setq title t) (setq title (y-or-n-p "Use the fic title in exports?"))
(setq multichapter t) (setq multichapter (y-or-n-p "Multichapter?"))
(setq chaptertitles nil) (if multichapter
(setq ffx t)) (setq chaptertitles (y-or-n-p "Titled chapters?")))
(progn (setq ffx (y-or-n-p "FFX fic?"))))
(setq title (y-or-n-p "Use the fic title in exports?")) (setq draftmode (y-or-n-p "Edit LaTeX file manually?"))
(setq multichapter (y-or-n-p "Multichapter?")) (org-format)
(if multichapter (save-buffer)
(setq chaptertitles (y-or-n-p "Titled chapters?")))
(setq ffx (y-or-n-p "FFX fic?"))))
(setq draftmode (y-or-n-p "Edit LaTeX file manually?"))
(org-format)
(save-buffer)
(goto-char (point-min))
(while (re-search-forward "\\[fn:\\([0-9]*\\):\\(.*\\)\\]" nil t)
(replace-match "@@html:<label for=\"\\1\" class=\"margin-toggle sidenote-number\"></label><input type=\"checkbox\" id=\"\\1\" class=\"margin-toggle\"/><span class=\"sidenote\">\\2</span>@@@@latex:\\\\footnote{\\2}@@"))
(let ((user-full-name "ovely")
(org-html-head "<link rel=\"preconnect\" href=\"https://fonts.googleapis.com\"/><link rel=\"preconnect\" href=\"https://fonts.gstatic.com\" crossorigin/><link href=\"https://fonts.googleapis.com/css2?family=EB+Garamond:ital,wght@0,400;0,700;1,400;1,700&display=swap\" rel=\"stylesheet\"/><link rel=\"stylesheet\" href=\"/fic/tufte.css\"/>"))
(org-html-export-to-html)
(org-latex-export-to-latex))
(revert-buffer t t)
(setq htmlfile (concat (file-name-base) ".html"))
(find-file-noselect htmlfile)
(with-current-buffer htmlfile
(goto-char (point-min))
(while (re-search-forward "<div id=\"content\"" nil t)
(replace-match "<article id=\"content\""))
(goto-char (point-min))
(while (re-search-forward "<div id=\"outline-container-" nil t)
(replace-match "<section id=\"outline-container-"))
(goto-char (point-min))
(while (re-search-forward "</div>\n</div>" nil t)
(replace-match "</div>\n</section>"))
(goto-char (point-min))
(while (re-search-forward "<hr />\n\n<p>" nil t)
(replace-match "</section>\n<section>\n<p class=\"newthought\">"))
(goto-char (point-min))
(while (re-search-forward "<hr>\n\n<p>" nil t)
(replace-match "</section>\n<section>\n<p class=\"newthought\">"))
(goto-char (point-min))
(while (re-search-forward "<div class=\"outline-text-2\" id=\".*\">" nil t)
(replace-match ""))
(goto-char (point-min))
(while (re-search-forward "<div id=\"postamble\" class=\"status\">" nil t)
(replace-match ""))
(goto-char (point-min))
(while (re-search-forward "<p class=\"validation\"><a href=.*>Validate</a></p>" nil t)
(replace-match ""))
(goto-char (point-min))
(while (re-search-forward "</div>" nil t)
(replace-match ""))
(goto-char (point-min))
(while (re-search-forward "section-number-2\">\\([0-9]*\\)<" nil t)
(replace-match "section-number-2\">\\1\.<"))
(goto-char (point-min))
(while (re-search-forward "<p class=\"author.*</p>" nil t)
(replace-match ""))
(goto-char (point-min)) (goto-char (point-min))
(while (re-search-forward "\n\n</body>" nil t) (while (re-search-forward "\\[fn:\\([0-9]*\\):\\(.*\\)\\]" nil t)
(replace-match "\n</article>\n</body>")) (replace-match "@@html:<label for=\"\\1\" class=\"margin-toggle sidenote-number\"></label><input type=\"checkbox\" id=\"\\1\" class=\"margin-toggle\"/><span class=\"sidenote\">\\2</span>@@@@latex:\\\\footnote{\\2}@@"))
(if (not title) (let ((user-full-name "ovely")
(org-html-head "<link rel=\"preconnect\" href=\"https://fonts.googleapis.com\"/><link rel=\"preconnect\" href=\"https://fonts.gstatic.com\" crossorigin/><link href=\"https://fonts.googleapis.com/css2?family=EB+Garamond:ital,wght@0,400;0,700;1,400;1,700&display=swap\" rel=\"stylesheet\"/><link rel=\"stylesheet\" href=\"/fic/tufte.css\"/>"))
(org-html-export-to-html)
(org-latex-export-to-latex))
(revert-buffer t t)
(setq htmlfile (concat (file-name-base) ".html"))
(find-file-noselect htmlfile)
(with-current-buffer htmlfile
(goto-char (point-min))
(while (re-search-forward "<div id=\"content\"" nil t)
(replace-match "<article id=\"content\""))
(goto-char (point-min))
(while (re-search-forward "<div id=\"outline-container-" nil t)
(replace-match "<section id=\"outline-container-"))
(goto-char (point-min))
(while (re-search-forward "</div>\n</div>" nil t)
(replace-match "</div>\n</section>"))
(goto-char (point-min))
(while (re-search-forward "<hr />\n\n<p>" nil t)
(replace-match "</section>\n<section>\n<p class=\"newthought\">"))
(goto-char (point-min))
(while (re-search-forward "<hr>\n\n<p>" nil t)
(replace-match "</section>\n<section>\n<p class=\"newthought\">"))
(goto-char (point-min))
(while (re-search-forward "<div class=\"outline-text-2\" id=\".*\">" nil t)
(replace-match ""))
(goto-char (point-min))
(while (re-search-forward "<div id=\"postamble\" class=\"status\">" nil t)
(replace-match ""))
(goto-char (point-min))
(while (re-search-forward "<p class=\"validation\"><a href=.*>Validate</a></p>" nil t)
(replace-match ""))
(goto-char (point-min))
(while (re-search-forward "</div>" nil t)
(replace-match ""))
(goto-char (point-min))
(while (re-search-forward "section-number-2\">\\([0-9]*\\)<" nil t)
(replace-match "section-number-2\">\\1\.<"))
(goto-char (point-min))
(while (re-search-forward "<p class=\"author.*</p>" nil t)
(replace-match ""))
(goto-char (point-min))
(while (re-search-forward "\n\n</body>" nil t)
(replace-match "\n</article>\n</body>"))
(if (not title)
(progn
(goto-char (point-min))
(while (re-search-forward "<h1.*" nil t)
(replace-match ""))))
(if multichapter
(if (not chaptertitles)
(progn
(goto-char (point-min))
(while (re-search-forward "<span class=\"section-number-.*</span>" nil t)
(replace-match ""))))
(progn (progn
(goto-char (point-min)) (goto-char (point-min))
(while (re-search-forward "<h1.*" nil t) (while (re-search-forward "<h2.*" nil t)
(replace-match "")))) (replace-match ""))))
(if multichapter (save-buffer)
(if (not chaptertitles) (kill-current-buffer))
(progn (setq texfile (concat (file-name-base) ".tex"))
(goto-char (point-min)) (find-file-noselect texfile)
(while (re-search-forward "<span class=\"section-number-.*</span>" nil t) (with-current-buffer texfile
(replace-match "")))) (shell-command
(progn (format "pandoc %s -o %s.epub"
(goto-char (point-min)) (shell-quote-argument (buffer-file-name))
(while (re-search-forward "<h2.*" nil t) (shell-quote-argument (file-name-base))))
(replace-match "")))) (goto-char (point-min))
(save-buffer) (while (re-search-forward "label{\\(.*\\)}\n\\([A-Z]\\)\\([a-z]*\\)" nil t)
(kill-current-buffer)) (replace-match "label{\\1}\n\\\\lettrine{\\2}{\\3}"))
(setq texfile (concat (file-name-base) ".tex")) (goto-char (point-min))
(find-file-noselect texfile) (while (re-search-forward "label{\\(.*\\)}\n\\([A-Z]\\)\\([a-z]*\\)" nil t)
(with-current-buffer texfile (replace-match "label{\\1}\n\\\\lettrine{“\\2}{\\3}"))
(shell-command (if ffx
(format "pandoc %s -o %s.epub" (progn
(shell-quote-argument (buffer-file-name)) (goto-char (point-min))
(shell-quote-argument (file-name-base)))) (while (re-search-forward "\\\\noindent\\\\rule{\\\\textwidth}{0.5pt}" nil t)
(goto-char (point-min)) (replace-match "\\sepffx" nil t)))
(while (re-search-forward "label{\\(.*\\)}\n\\([A-Z]\\)\\([a-z]*\\)" nil t)
(replace-match "label{\\1}\n\\\\lettrine{\\2}{\\3}"))
(goto-char (point-min))
(while (re-search-forward "label{\\(.*\\)}\n\\([A-Z]\\)\\([a-z]*\\)" nil t)
(replace-match "label{\\1}\n\\\\lettrine{“\\2}{\\3}"))
(if ffx
(progn (progn
(goto-char (point-min)) (goto-char (point-min))
(while (re-search-forward "\\\\noindent\\\\rule{\\\\textwidth}{0.5pt}" nil t) (while (re-search-forward "\\\\noindent\\\\rule{\\\\textwidth}{0.5pt}" nil t)
(replace-match "\\sepffx" nil t))) (replace-match "\\sephim" nil t))))
(progn (if multichapter
(goto-char (point-min)) (if title
(while (re-search-forward "\\\\noindent\\\\rule{\\\\textwidth}{0.5pt}" nil t) (if asal
(replace-match "\\sephim" nil t)))) (progn
(if multichapter (goto-char (point-min))
(if title (while (re-search-forward "\\\\maketitle" nil t)
(if asal (replace-match "\\begin{titlingpage}\n\\titleasal\n\\end{titlingpage}" nil t)))
(progn (progn
(goto-char (point-min)) (goto-char (point-min))
(while (re-search-forward "\\\\maketitle" nil t) (while (re-search-forward "\\\\maketitle" nil t)
(replace-match "\\begin{titlingpage}\n\\titleasal\n\\end{titlingpage}" nil t))) (replace-match "\\begin{titlingpage}\n\\titlegen\n\\end{titlingpage}" nil t))))
(progn
(goto-char (point-min))
(while (re-search-forward "\\\\maketitle" nil t)
(replace-match "\\begin{titlingpage}\n\\titlegen\n\\end{titlingpage}" nil t))))
(progn
(goto-char (point-min))
(while (re-search-forward "\\\\maketitle" nil t)
(replace-match ""))))
(progn
(goto-char (point-min))
(while (re-search-forward "\\\\maketitle" nil t)
(replace-match ""))))
(if multichapter
(if (not chaptertitles)
(progn (progn
(goto-char (point-min)) (goto-char (point-min))
(while (re-search-forward "namechapters" nil t) (while (re-search-forward "\\\\maketitle" nil t)
(replace-match "nonamechapters")))) (replace-match ""))))
(progn (progn
(goto-char (point-min)) (goto-char (point-min))
(while (re-search-forward "\\\\chapter.*" nil t) (while (re-search-forward "\\\\maketitle" nil t)
(replace-match "")) (replace-match ""))))
(if title (if multichapter
(progn (if (not chaptertitles)
(goto-char (point-min)) (progn
(while (re-search-forward "\\\\begin{document}" nil t) (goto-char (point-min))
(replace-match "\\\\begin{document}\n\\\\chapter\*{\\\\thetitle}")))))) (while (re-search-forward "namechapters" nil t)
(if multichapter (replace-match "nonamechapters"))))
(if title (progn
(if chaptertitles (goto-char (point-min))
(while (re-search-forward "\\\\chapter.*" nil t)
(replace-match ""))
(if title
(progn
(goto-char (point-min))
(while (re-search-forward "\\\\begin{document}" nil t)
(replace-match "\\\\begin{document}\n\\\\chapter\*{\\\\thetitle}"))))))
(if multichapter
(if title
(if chaptertitles
(progn
(goto-char (point-min))
(while (re-search-forward "\\\\begin{document}" nil t)
(replace-match "\\begin{document}\n\\pagestyle{multititlechapters}" nil t))
(goto-char (point-min))
(while (re-search-forward "\\\\end{titlingpage}" nil t)
(replace-match "\\end{titlingpage}\n\\tableofcontents\*" nil t)))
(progn (progn
(goto-char (point-min)) (goto-char (point-min))
(while (re-search-forward "\\\\begin{document}" nil t) (while (re-search-forward "\\\\begin{document}" nil t)
(replace-match "\\begin{document}\n\\pagestyle{multititlechapters}" nil t)) (replace-match "\\begin{document}\n\\pagestyle{multititlenochapters}" nil t))))
(if chaptertitles
(progn
(goto-char (point-min)) (goto-char (point-min))
(while (re-search-forward "\\\\end{titlingpage}" nil t) (while (re-search-forward "\\\\begin{document}" nil t)
(replace-match "\\end{titlingpage}\n\\tableofcontents\*" nil t))) (replace-match "\\begin{document}\n\\pagestyle{multinotitlechapters}\n\\tableofcontents\*" nil t)))
(progn
(goto-char (point-min))
(while (re-search-forward "\\\\begin{document}" nil t)
(replace-match "\\begin{document}\n\\pagestyle{multititlenochapters}" nil t))))
(if chaptertitles
(progn (progn
(goto-char (point-min)) (goto-char (point-min))
(while (re-search-forward "\\\\begin{document}" nil t) (while (re-search-forward "\\\\begin{document}" nil t)
(replace-match "\\begin{document}\n\\pagestyle{multinotitlechapters}\n\\tableofcontents\*" nil t))) (replace-match "\\begin{document}\n\\pagestyle{multinotitlenochapters}" nil t)))))
(if title
(progn (progn
(goto-char (point-min)) (goto-char (point-min))
(while (re-search-forward "\\\\begin{document}" nil t) (while (re-search-forward "\\\\begin{document}" nil t)
(replace-match "\\begin{document}\n\\pagestyle{multinotitlenochapters}" nil t))))) (replace-match "\\begin{document}\n\\pagestyle{singletitle}" nil t)))
(if title
(progn (progn
(goto-char (point-min)) (goto-char (point-min))
(while (re-search-forward "\\\\begin{document}" nil t) (while (re-search-forward "\\\\begin{document}" nil t)
(replace-match "\\begin{document}\n\\pagestyle{singletitle}" nil t))) (replace-match "\\begin{document}\n\\pagestyle{plain}" nil t)))))
(progn (goto-char (point-max))
(goto-char (point-min)) (save-buffer)
(while (re-search-forward "\\\\begin{document}" nil t) (unless draftmode
(replace-match "\\begin{document}\n\\pagestyle{plain}" nil t))))) (shell-command
(goto-char (point-max)) (format "xelatex -interaction=batchmode %s"
(save-buffer) (shell-quote-argument (buffer-file-name))))
(shell-command
(format "xelatex -interaction=batchmode %s"
(shell-quote-argument (buffer-file-name)))))
(kill-current-buffer))
(unless draftmode (unless draftmode
(shell-command (delete-file "FFXYevon.ttf")
(format "xelatex -interaction=batchmode %s" (if (file-exists-p (concat (file-name-base) ".aux"))
(shell-quote-argument (buffer-file-name)))) (delete-file (concat (file-name-base) ".aux")))
(shell-command (if (file-exists-p (concat (file-name-base) ".log"))
(format "xelatex -interaction=batchmode %s" (delete-file (concat (file-name-base) ".log")))
(shell-quote-argument (buffer-file-name))))) (if (file-exists-p (concat (file-name-base) ".out"))
(kill-current-buffer)) (delete-file (concat (file-name-base) ".out")))
(unless draftmode (if (file-exists-p (concat (file-name-base) ".toc"))
(delete-file "FFXYevon.ttf") (delete-file (concat (file-name-base) ".toc")))
(if (file-exists-p (concat (file-name-base) ".aux")) (if (file-exists-p "texput.log")
(delete-file (concat (file-name-base) ".aux"))) (delete-file "texput.log"))
(if (file-exists-p (concat (file-name-base) ".log")) (delete-file texfile))
(delete-file (concat (file-name-base) ".log"))) (message "Done")))
(if (file-exists-p (concat (file-name-base) ".out"))
(delete-file (concat (file-name-base) ".out")))
(if (file-exists-p (concat (file-name-base) ".toc"))
(delete-file (concat (file-name-base) ".toc")))
(if (file-exists-p "texput.log")
(delete-file "texput.log"))
(delete-file texfile))
(message "Done"))

@ -1,6 +1,7 @@
(setq periodfile (concat (file-name-as-directory fileroot) "admin/emacs/period.org"))
(defun periodise () (defun periodise ()
"Return day of menstrual cycle" "Return day of menstrual cycle"
(setq periodfile "~/Documents/drive/admin/emacs/period.org")
(find-file-noselect periodfile) (find-file-noselect periodfile)
(setq thebuffer (file-name-nondirectory periodfile)) (setq thebuffer (file-name-nondirectory periodfile))
(with-current-buffer thebuffer (with-current-buffer thebuffer
@ -20,7 +21,6 @@
(defun menstruate () (defun menstruate ()
"Mark beginning of menstrual cycle" "Mark beginning of menstrual cycle"
(interactive) (interactive)
(setq periodfile "~/Documents/drive/admin/emacs/period.org")
(find-file-noselect periodfile) (find-file-noselect periodfile)
(setq thebuffer (file-name-nondirectory periodfile)) (setq thebuffer (file-name-nondirectory periodfile))
(with-current-buffer thebuffer (with-current-buffer thebuffer

@ -1,4 +1,6 @@
(load-file "~/Documents/drive/admin/emacs/daysoff.el") (if (string-equal system-type "android")
(load-file "/storage/emulated/0/Documents/admin/emacs/daysoff.el")
(load-file "~/Documents/drive/admin/emacs/daysoff.el"))
(defcustom workday nil (defcustom workday nil
"Returns true on working days" "Returns true on working days"

Loading…
Cancel
Save