Add Android functionality
This commit is contained in:
parent
cd9c277a69
commit
0c96e9885c
5 changed files with 634 additions and 600 deletions
695
config.org
695
config.org
File diff suppressed because it is too large
Load diff
192
custom/dwpost.el
192
custom/dwpost.el
|
@ -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)
|
|
||||||
(setq music "nil"))
|
|
||||||
(if (equal music "nil")
|
|
||||||
(sleep-for 0)
|
|
||||||
(insert (concat "post-music: "
|
|
||||||
(let* ((musicjunk
|
|
||||||
(format "%S" music))
|
|
||||||
(end (- (length musicjunk) 4)))
|
|
||||||
(substring musicjunk 4 end))"\n"))))
|
|
||||||
|
|
||||||
(defun dwicon (thefile)
|
|
||||||
"Set icon for DW post"
|
|
||||||
(setq icon "skip")
|
|
||||||
(load-file dw-iconfile)
|
|
||||||
(with-current-buffer thefile
|
|
||||||
(iconchoose))
|
|
||||||
(if (equal icon "skip")
|
|
||||||
(sleep-for 0)
|
|
||||||
(insert (concat "post-icon: "icon "\n"))))
|
|
||||||
|
|
||||||
(defun dwlocation ()
|
|
||||||
"Set location for DW post"
|
|
||||||
(setq location (read-string "Location: " dw-defaultlocation))
|
|
||||||
(if (equal location "")
|
|
||||||
(sleep-for 0)
|
|
||||||
(insert (concat "post-location: " location "\n"))))
|
|
||||||
|
|
||||||
(defun dwmusic-manual ()
|
|
||||||
"Set current music for DW post if lastfm.el not set up"
|
|
||||||
(setq music (read-string "Music: "))
|
|
||||||
(if (equal music "")
|
|
||||||
(sleep-for 0)
|
|
||||||
(insert (concat "post-music: " music "\n"))))
|
|
||||||
|
|
||||||
(defun dw-posted ()
|
|
||||||
"Log DW post"
|
|
||||||
(find-file-noselect "~/Documents/drive/org/calendar/habit.org")
|
|
||||||
(with-current-buffer "habit.org"
|
|
||||||
(goto-char (point-min))
|
|
||||||
(re-search-forward "RECUR dw posts")
|
|
||||||
(org-shiftright)
|
|
||||||
(sleep-for 1)
|
(sleep-for 1)
|
||||||
(save-buffer)))
|
(if (not music)
|
||||||
|
(setq music "nil"))
|
||||||
|
(if (equal music "nil")
|
||||||
|
(sleep-for 0)
|
||||||
|
(insert (concat "post-music: "
|
||||||
|
(let* ((musicjunk
|
||||||
|
(format "%S" music))
|
||||||
|
(end (- (length musicjunk) 4)))
|
||||||
|
(substring musicjunk 4 end))"\n")))))
|
||||||
|
|
||||||
(defun dwpost (psubject tags)
|
(unless (string-equal system-type "android")
|
||||||
"Post to DW"
|
(defun dwicon (thefile)
|
||||||
(interactive (list (read-string "Post title (REQUIRED): ")
|
"Set icon for DW post"
|
||||||
(read-string "Tags (comma-separated): ")))
|
(setq icon "skip")
|
||||||
(dwexport)
|
(load-file dw-iconfile)
|
||||||
(compose-mail (concat dw-username "+" dw-pin "@post.dreamwidth.org") psubject)
|
(with-current-buffer thefile
|
||||||
(with-current-buffer (concat "*unsent mail to " dw-username "*")
|
(iconchoose))
|
||||||
(insert (concat "post-tags: org-export, " tags "\n"))
|
(if (equal icon "skip")
|
||||||
(dwsecurity)
|
(sleep-for 0)
|
||||||
(dwlocation)
|
(insert (concat "post-icon: "icon "\n")))))
|
||||||
(dwicon newname)
|
|
||||||
(cond
|
(unless (string-equal system-type "android")
|
||||||
(lastfm-login t (dwmusic))
|
(defun dwlocation ()
|
||||||
((dwmusic-manual)))
|
"Set location for DW post"
|
||||||
(dwmood)
|
(setq location (read-string "Location: " dw-defaultlocation))
|
||||||
(insert (concat "\n"))
|
(if (equal location "")
|
||||||
(insert-file-contents newname)
|
(sleep-for 0)
|
||||||
(message-send-and-exit))
|
(insert (concat "post-location: " location "\n")))))
|
||||||
(kill-buffer newname)
|
|
||||||
(kill-buffer (concat "*sent mail to " dw-username "*"))
|
(unless (string-equal system-type "android")
|
||||||
(with-current-buffer oldname
|
(defun dwmusic-manual ()
|
||||||
(delete-file newname))
|
"Set current music for DW post if lastfm.el not set up"
|
||||||
(dw-posted))
|
(setq music (read-string "Music: "))
|
||||||
|
(if (equal music "")
|
||||||
|
(sleep-for 0)
|
||||||
|
(insert (concat "post-music: " music "\n")))))
|
||||||
|
|
||||||
|
(unless (string-equal system-type "android")
|
||||||
|
(defun dw-posted ()
|
||||||
|
"Log DW post"
|
||||||
|
(find-file-noselect "~/Documents/drive/org/calendar/habit.org")
|
||||||
|
(with-current-buffer "habit.org"
|
||||||
|
(goto-char (point-min))
|
||||||
|
(re-search-forward "RECUR dw posts")
|
||||||
|
(org-shiftright)
|
||||||
|
(sleep-for 4)
|
||||||
|
(save-buffer))))
|
||||||
|
|
||||||
|
(unless (string-equal system-type "android")
|
||||||
|
(defun dwpost (psubject tags)
|
||||||
|
"Post to DW"
|
||||||
|
(interactive (list (read-string "Post title (REQUIRED): ")
|
||||||
|
(read-string "Tags (comma-separated): ")))
|
||||||
|
(dwexport)
|
||||||
|
(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)
|
||||||
|
(insert (concat "\n"))
|
||||||
|
(insert-file-contents newname)
|
||||||
|
(message-send-and-exit))
|
||||||
|
(kill-buffer newname)
|
||||||
|
(kill-buffer (concat "*sent mail to " dw-username "*"))
|
||||||
|
(with-current-buffer oldname
|
||||||
|
(delete-file newname))
|
||||||
|
(dw-posted)))
|
||||||
|
|
339
custom/fic.el
339
custom/fic.el
|
@ -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)
|
||||||
|
(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))
|
||||||
|
(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 multichapter
|
||||||
(setq chaptertitles (y-or-n-p "Titled chapters?")))
|
(if (not chaptertitles)
|
||||||
(setq ffx (y-or-n-p "FFX fic?"))))
|
(progn
|
||||||
(setq draftmode (y-or-n-p "Edit LaTeX file manually?"))
|
(goto-char (point-min))
|
||||||
(org-format)
|
(while (re-search-forward "<span class=\"section-number-.*</span>" nil t)
|
||||||
(save-buffer)
|
(replace-match ""))))
|
||||||
(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))
|
|
||||||
(while (re-search-forward "\n\n</body>" nil t)
|
|
||||||
(replace-match "\n</article>\n</body>"))
|
|
||||||
(if (not title)
|
|
||||||
(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 ""))))
|
||||||
|
(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 "\\\\maketitle" nil t)
|
(while (re-search-forward "namechapters" nil t)
|
||||||
(replace-match "\\begin{titlingpage}\n\\titlegen\n\\end{titlingpage}" nil t))))
|
(replace-match "nonamechapters"))))
|
||||||
(progn
|
(progn
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
(while (re-search-forward "\\\\maketitle" nil t)
|
(while (re-search-forward "\\\\chapter.*" nil t)
|
||||||
(replace-match ""))))
|
(replace-match ""))
|
||||||
(progn
|
(if title
|
||||||
(goto-char (point-min))
|
(progn
|
||||||
(while (re-search-forward "\\\\maketitle" nil t)
|
(goto-char (point-min))
|
||||||
(replace-match ""))))
|
(while (re-search-forward "\\\\begin{document}" nil t)
|
||||||
(if multichapter
|
(replace-match "\\\\begin{document}\n\\\\chapter\*{\\\\thetitle}"))))))
|
||||||
(if (not chaptertitles)
|
(if multichapter
|
||||||
(progn
|
(if title
|
||||||
(goto-char (point-min))
|
(if chaptertitles
|
||||||
(while (re-search-forward "namechapters" nil t)
|
(progn
|
||||||
(replace-match "nonamechapters"))))
|
(goto-char (point-min))
|
||||||
(progn
|
(while (re-search-forward "\\\\begin{document}" nil t)
|
||||||
(goto-char (point-min))
|
(replace-match "\\begin{document}\n\\pagestyle{multititlechapters}" nil t))
|
||||||
(while (re-search-forward "\\\\chapter.*" nil t)
|
(goto-char (point-min))
|
||||||
(replace-match ""))
|
(while (re-search-forward "\\\\end{titlingpage}" nil t)
|
||||||
(if title
|
(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\\\\chapter\*{\\\\thetitle}"))))))
|
(replace-match "\\begin{document}\n\\pagestyle{multititlenochapters}" nil t))))
|
||||||
(if multichapter
|
|
||||||
(if title
|
|
||||||
(if chaptertitles
|
(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{multititlechapters}" nil t))
|
(replace-match "\\begin{document}\n\\pagestyle{multinotitlechapters}\n\\tableofcontents\*" 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{multititlenochapters}" nil t))))
|
(replace-match "\\begin{document}\n\\pagestyle{multinotitlenochapters}" nil t)))))
|
||||||
(if chaptertitles
|
(if title
|
||||||
(progn
|
|
||||||
(goto-char (point-min))
|
|
||||||
(while (re-search-forward "\\\\begin{document}" nil t)
|
|
||||||
(replace-match "\\begin{document}\n\\pagestyle{multinotitlechapters}\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{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…
Add table
Add a link
Reference in a new issue