General cleanup: reorganising snippets, tidying if statements, documenting functions

master
trémeur 2 years ago
parent 18c64c71c4
commit 4aa4de17f5

@ -1,5 +1,6 @@
(load-file "~/.emacs.d/agenda-common.el")
(load-file "~/.emacs.d/custom/workday.el") (load-file "~/.emacs.d/custom/workday.el")
(if (isworkday) (if workday
(if (< (string-to-number (format-time-string "%H")) 19) (if (< (string-to-number (format-time-string "%H")) 19)
(if (> (string-to-number (format-time-string "%H")) 7) (if (> (string-to-number (format-time-string "%H")) 7)
(setq org-agenda-files (list "~/Documents/drive/org/calendar/admin.org" "~/Documents/drive/org/calendar/home.org" "~/Documents/drive/org/calendar/music.org" "~/Documents/drive/org/calendar/work.org")) (setq org-agenda-files (list "~/Documents/drive/org/calendar/admin.org" "~/Documents/drive/org/calendar/home.org" "~/Documents/drive/org/calendar/music.org" "~/Documents/drive/org/calendar/work.org"))
@ -7,5 +8,3 @@
(setq org-agenda-files (list "~/Documents/drive/org/calendar/admin.org" "~/Documents/drive/org/calendar/home.org" "~/Documents/drive/org/calendar/music.org" "~/Documents/drive/org/calendar/personal.org"))) (setq org-agenda-files (list "~/Documents/drive/org/calendar/admin.org" "~/Documents/drive/org/calendar/home.org" "~/Documents/drive/org/calendar/music.org" "~/Documents/drive/org/calendar/personal.org")))
(setq org-agenda-files (list "~/Documents/drive/org/calendar/admin.org" "~/Documents/drive/org/calendar/home.org" "~/Documents/drive/org/calendar/music.org" "~/Documents/drive/org/calendar/personal.org"))) (setq org-agenda-files (list "~/Documents/drive/org/calendar/admin.org" "~/Documents/drive/org/calendar/home.org" "~/Documents/drive/org/calendar/music.org" "~/Documents/drive/org/calendar/personal.org")))
(setq org-agenda-prefix-format '((agenda . "%?-12t%s"))) (setq org-agenda-prefix-format '((agenda . "%?-12t%s")))
;; (setq org-deadline-warning-days 0)
(load-file "~/.emacs.d/agenda-common.el")

@ -1,15 +1,3 @@
* =$whoami=, a big neckbeard, thats who
Set basic information, false-online-pseudonym-of-a-name, approximate location.
#+BEGIN_SRC emacs-lisp
(setq user-mail-address "eheu48@gmail.com")
(setq user-full-name "Trémeur Karahés")
(setq calendar-latitude 54.59)
(setq calendar-longitude -5.88)
(setq calendar-location-name "Belfast")
#+END_SRC
* Systems * Systems
Define functions that specify what OS Im on, also whether Im at work or not. Then I can implement specific packages according to need/compatibility. Define functions that specify what OS Im on, also whether Im at work or not. Then I can implement specific packages according to need/compatibility.
@ -23,7 +11,7 @@ Define functions that specify what OS Im on, also whether Im at work or no
"Return true if on windows" "Return true if on windows"
(string-equal system-type "windows-nt")) (string-equal system-type "windows-nt"))
(defun ismac () (defun ismac () ;; unkikely now, but might as well keep this
"Return true if on macos" "Return true if on macos"
(string-equal system-type "darwin")) (string-equal system-type "darwin"))
@ -32,6 +20,16 @@ Define functions that specify what OS Im on, also whether Im at work or no
(string-equal user-login-name "3055822")) (string-equal user-login-name "3055822"))
#+END_SRC #+END_SRC
* =$whoami=, a big neckbeard, thats who
Set name and location based on who Im being right now.
#+BEGIN_SRC emacs-lisp
(if (atwork)
(load-file "~/Documents/drive/admin/emacs/identity-work.el")
(load-file "~/Documents/drive/admin/emacs/identity-home.el"))
#+END_SRC
* It's not 1986 * It's not 1986
Set everything to UTF-8. I use accented characters regularly. Set everything to UTF-8. I use accented characters regularly.
@ -40,8 +38,9 @@ Set everything to UTF-8. I use accented characters regularly.
(prefer-coding-system 'utf-8) (prefer-coding-system 'utf-8)
(set-default-coding-systems 'utf-8) (set-default-coding-systems 'utf-8)
(set-language-environment 'utf-8) (set-language-environment 'utf-8)
(unless (iswin) (set-selection-coding-system 'utf-8)) (if (iswin)
(when (iswin) (set-selection-coding-system 'utf-16-le)) (set-selection-coding-system 'utf-16-le)
(set-selection-coding-system 'utf-8))
#+END_SRC #+END_SRC
* Sonic arts * Sonic arts
@ -63,10 +62,11 @@ Also suppress certain warnings that would otherwise come up all the time and con
* Miscellaneous changes to make to the basic config * Miscellaneous changes to make to the basic config
Firstly, tell Emacs where to look for custom functions. Firstly, tell Emacs where to look for custom functions (via [[https://www.emacswiki.org/emacs/LoadingLispFiles][EmacsWiki]]).
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(defun load-directory (dir) (defun load-directory (dir)
"Add all files in a directory to load-path"
(let ((load-it (lambda (f) (let ((load-it (lambda (f)
(load-file (concat (file-name-as-directory dir) f))))) (load-file (concat (file-name-as-directory dir) f)))))
(mapc load-it (directory-files dir nil "\\.el$")))) (mapc load-it (directory-files dir nil "\\.el$"))))
@ -87,6 +87,7 @@ Make the +window+ /frame/ look nice and clean. Scroll bars behave pointlessly on
(setq inhibit-startup-screen t) (setq inhibit-startup-screen t)
(tool-bar-mode -1) (tool-bar-mode -1)
(scroll-bar-mode -1) (scroll-bar-mode -1)
(tooltip-mode -1)
#+END_SRC #+END_SRC
Make everything just a little tiny bit transparent unless Im using the boring Windows desktop. Make everything just a little tiny bit transparent unless Im using the boring Windows desktop.
@ -154,6 +155,7 @@ Make new directories automatically (from [[https://emacsredux.com/blog/2022/06/1
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(defun er-auto-create-missing-dirs () (defun er-auto-create-missing-dirs ()
"Make new directories automatically"
(let ((target-dir (file-name-directory buffer-file-name))) (let ((target-dir (file-name-directory buffer-file-name)))
(unless (file-exists-p target-dir) (unless (file-exists-p target-dir)
(make-directory target-dir t)))) (make-directory target-dir t))))
@ -168,8 +170,7 @@ On Linux, I have to tell Emacs to use Chrome for web links.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(when (islin) (when (islin)
(setq browse-url-browser-function 'browse-url-generic (setq browse-url-browser-function 'browse-url-generic
browse-url-generic-program "google-chrome" browse-url-generic-program "google-chrome"))
))
#+END_SRC #+END_SRC
Honestly I dont know if Ill ever use macOS again, but in case I do, I need the meta key to work. Honestly I dont know if Ill ever use macOS again, but in case I do, I need the meta key to work.
@ -296,6 +297,7 @@ Standard =elfeed= settings:
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(defun elfeed-load-db-and-open () (defun elfeed-load-db-and-open ()
"Load and open the elfeed DB"
(interactive) (interactive)
(elfeed-db-load) (elfeed-db-load)
(elfeed) (elfeed)
@ -311,13 +313,15 @@ Standard =elfeed= settings:
'(define-key elfeed-search-mode-map (kbd "m") 'elfeed-toggle-star)) '(define-key elfeed-search-mode-map (kbd "m") 'elfeed-toggle-star))
(defun elfeed-save-db-and-bury () (defun elfeed-save-db-and-bury ()
"Save and close the elfeed DB"
(interactive) (interactive)
(elfeed-db-save) (elfeed-db-save)
(quit-window)) (quit-window))
(use-package elfeed (use-package elfeed
:bind (:map elfeed-search-mode-map :bind
("q" . elfeed-save-db-and-bury)) (:map elfeed-search-mode-map
("q" . elfeed-save-db-and-bury))
:custom :custom
(elfeed-sort-order 'ascending) (elfeed-sort-order 'ascending)
(elfeed-db-directory "~/Documents/drive/org/elfeed")) (elfeed-db-directory "~/Documents/drive/org/elfeed"))
@ -327,6 +331,7 @@ I am a huge supporter of big-endian date formats.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(defun elfeed-search-format-date (date) (defun elfeed-search-format-date (date)
"Set elfeed to display big-endian dates"
(format-time-string "%Y-%m-%d %H:%M" (seconds-to-time date))) (format-time-string "%Y-%m-%d %H:%M" (seconds-to-time date)))
#+END_SRC #+END_SRC
@ -342,6 +347,7 @@ Save elfeed state properly when exiting Emacs.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(defun save-if-elfeed () (defun save-if-elfeed ()
"Save the elfeed DB if elfeed is running"
(if (get-buffer "*elfeed-search*") (if (get-buffer "*elfeed-search*")
(progn (progn
(elfeed-db-save) (elfeed-db-save)
@ -373,7 +379,7 @@ This works only for =emacs27= and above, and I dont want to use it at work, s
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(unless (version< emacs-version "27") (unless (version< emacs-version "27")
(unless (atwork) (unless (atwork)
(use-package lastfm))) (use-package lastfm)))
#+END_SRC #+END_SRC
** =markdown-mode= ** =markdown-mode=
@ -385,8 +391,8 @@ I kind of hate markdown but I still have to use it sometimes.
:mode (("README\\.md\\'" . gfm-mode) :mode (("README\\.md\\'" . gfm-mode)
("\\.md\\'" . markdown-mode) ("\\.md\\'" . markdown-mode)
("\\.markdown\\'" . markdown-mode)) ("\\.markdown\\'" . markdown-mode))
:init :hook
(add-hook 'markdown-mode-hook 'auto-fill-mode) (markdown-mode . auto-fill-mode)
:config :config
(setq markdown-asymmetric-header t) (setq markdown-asymmetric-header t)
:custom :custom
@ -439,6 +445,7 @@ For reading ebooks. Only on Linux because I (supposedly) use it with my calibre
:init :init
(add-to-list 'auto-mode-alist '("\\.epub\\'" . nov-mode))) (add-to-list 'auto-mode-alist '("\\.epub\\'" . nov-mode)))
(defun my-nov-font-setup () (defun my-nov-font-setup ()
"Set the font for nov-mode"
(face-remap-add-relative 'variable-pitch :family "Liberation Serif" (face-remap-add-relative 'variable-pitch :family "Liberation Serif"
:height 2.0)) :height 2.0))
(add-hook 'nov-mode-hook 'my-nov-font-setup)) (add-hook 'nov-mode-hook 'my-nov-font-setup))
@ -532,11 +539,13 @@ Export non-breaking spaces properly; from, believe it or not, [[https://orgmode.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(unless (version< emacs-version "27") (unless (version< emacs-version "27")
(defun my-html-filter-nobreaks (text backend info) (defun my-html-filter-nobreaks (text backend info)
"Keep non-breaking spaces in HTML org export"
(when (org-export-derived-backend-p backend 'html) (when (org-export-derived-backend-p backend 'html)
(replace-regexp-in-string " " "&nbsp;" text))) (replace-regexp-in-string " " "&nbsp;" text)))
(add-to-list 'org-export-filter-plain-text-functions (add-to-list 'org-export-filter-plain-text-functions
'my-html-filter-nobreaks) 'my-html-filter-nobreaks)
(defun my-latex-filter-nobreaks (text backend info) (defun my-latex-filter-nobreaks (text backend info)
"Keep non-breaking spaces in LaTeX org export"
(when (org-export-derived-backend-p backend 'latex) (when (org-export-derived-backend-p backend 'latex)
(replace-regexp-in-string " " "~" text))) (replace-regexp-in-string " " "~" text)))
(add-to-list 'org-export-filter-plain-text-functions (add-to-list 'org-export-filter-plain-text-functions
@ -560,9 +569,11 @@ Automate a tiny part of something I was previously doing manually.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(unless (atwork) (unless (atwork)
(defun org-journal-file-header-func (time) (defun org-journal-file-header-func (time)
"Set the header for org-journal files"
(concat "<" (format-time-string "%Y-%m-%d %a") ">\n\n")) (concat "<" (format-time-string "%Y-%m-%d %a") ">\n\n"))
(use-package org-journal (use-package org-journal
:bind ("C-c j" . org-journal-new-entry) :bind
("C-c j" . org-journal-new-entry)
:config :config
(setq org-journal-dir "~/Documents/drive/org/journal") (setq org-journal-dir "~/Documents/drive/org/journal")
(setq org-journal-file-format "%Y/%m/%Y-%m-%d.org") (setq org-journal-file-format "%Y/%m/%Y-%m-%d.org")
@ -577,19 +588,20 @@ Automate a tiny part of something I was previously doing manually.
Use =org-modern= on =emacs27= and above (although Im still not wild about it), =org-bullets= otherwise. [[https://github.com/minad/org-modern/issues/5#issuecomment-1318003940][Fix for issue with table widths]], which makes me slightly less not-wild. Use =org-modern= on =emacs27= and above (although Im still not wild about it), =org-bullets= otherwise. [[https://github.com/minad/org-modern/issues/5#issuecomment-1318003940][Fix for issue with table widths]], which makes me slightly less not-wild.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(unless (version< emacs-version "27") (if (version< emacs-version "27")
(use-package org-modern (progn
:hook
(org-mode . org-modern-mode))
(set-face-attribute 'org-table nil :inherit 'fixed-pitch)
(custom-set-variables '(org-modern-table nil)))
(if (version< emacs-version "27")
(use-package org-bullets (use-package org-bullets
:custom :custom
(org-bullets-bullet-list '("✸")) (org-bullets-bullet-list '("✸"))
(org-ellipsis " ⤵") (org-ellipsis " ⤵")
:hook (org-mode . org-bullets-mode))) :hook
(org-mode . org-bullets-mode)))
(progn
(use-package org-modern
:hook
(org-mode . org-modern-mode))
(set-face-attribute 'org-table nil :inherit 'fixed-pitch)
(custom-set-variables '(org-modern-table nil))))
#+END_SRC #+END_SRC
**** =org-noter= **** =org-noter=
@ -610,7 +622,8 @@ Display the file outline in a sidebar.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(unless (version< emacs-version "27") (unless (version< emacs-version "27")
(use-package org-sidebar (use-package org-sidebar
:bind ("C-c C-x s" . org-sidebar-tree))) :bind
("C-c C-x s" . org-sidebar-tree)))
#+END_SRC #+END_SRC
**** =org-wc= **** =org-wc=
@ -620,7 +633,8 @@ Display word counts next to org headings.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(unless (version< emacs-version "27") (unless (version< emacs-version "27")
(use-package org-wc (use-package org-wc
:bind ("C-c C-x w" . org-wc-display))) :bind
("C-c C-x w" . org-wc-display)))
#+END_SRC #+END_SRC
*** Agenda settings *** Agenda settings
@ -645,7 +659,7 @@ Set the files to be included.
(add-to-list 'org-agenda-files "~/Documents/drive/org/calendar/acwri.org")) (add-to-list 'org-agenda-files "~/Documents/drive/org/calendar/acwri.org"))
(progn (progn
(add-to-list 'org-agenda-files "~/Documents/drive/org/calendar/home.org") (add-to-list 'org-agenda-files "~/Documents/drive/org/calendar/home.org")
(if (isworkday) (if workday
(if (< (string-to-number (format-time-string "%H")) 19) (if (< (string-to-number (format-time-string "%H")) 19)
(if (> (string-to-number (format-time-string "%H")) 7) (if (> (string-to-number (format-time-string "%H")) 7)
(progn (progn
@ -679,8 +693,8 @@ Add period information to the agenda header (this has a very weird output, compl
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(setq org-agenda-custom-commands (setq org-agenda-custom-commands
'(("a" "Slightly modified agenda view" '(("a" "Slightly modified agenda view"
((agenda "" ((agenda ""
((org-agenda-overriding-header (periodise)))))))) ((org-agenda-overriding-header (periodise))))))))
#+END_SRC #+END_SRC
Use a horizontal line to divide each day from the next. Use a horizontal line to divide each day from the next.
@ -713,16 +727,16 @@ Highlights matching bracket.
Use the superior package for viewing PDFs on the superior operating system, and use a less reliable one otherwise. Ghostscript has to be installed on Windows, but its indispensable anyway. Use the superior package for viewing PDFs on the superior operating system, and use a less reliable one otherwise. Ghostscript has to be installed on Windows, but its indispensable anyway.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(unless (iswin) (use-package pdf-tools (if (iswin)
:config (use-package doc-view
(pdf-tools-install)
(define-key pdf-view-mode-map (kbd "C-s") 'isearch-forward)
(add-hook 'pdf-view-mode-hook (lambda () (cua-mode 0)))
(setq pdf-view-resize-factor 1.1)))
(when (iswin) (use-package doc-view
:config :config
(setq doc-view-ghostscript-program "gswin32c"))) (setq doc-view-ghostscript-program "gswin32c"))
(use-package pdf-tools
:config
(pdf-tools-install)
(define-key pdf-view-mode-map (kbd "C-s") 'isearch-forward)
(add-hook 'pdf-view-mode-hook (lambda () (cua-mode 0)))
(setq pdf-view-resize-factor 1.1)))
#+END_SRC #+END_SRC
** =rainbow-mode= ** =rainbow-mode=
@ -745,7 +759,8 @@ Gives me a dialog with recently opened files. Package management and =elfeed= st
(recentf-mode 1) (recentf-mode 1)
(setq recentf-max-menu-items 20) (setq recentf-max-menu-items 20)
(setq recentf-max-saved-items 20) (setq recentf-max-saved-items 20)
(global-set-key "\C-x\ \C-r" 'recentf-open-files) (global-set-key (kbd "C-x C-r") 'recentf-open-files)
;; (global-set-key "\C-x\ \C-r" 'recentf-open-files)
(add-to-list 'recentf-exclude (add-to-list 'recentf-exclude
(expand-file-name "~/.emacs.d/elpa/*")) (expand-file-name "~/.emacs.d/elpa/*"))
(add-to-list 'recentf-exclude (add-to-list 'recentf-exclude
@ -765,7 +780,7 @@ As previously described, “the big boy”. I know little about most of these se
:init :init
(add-hook 'LaTeX-mode-hook 'turn-on-auto-fill) (add-hook 'LaTeX-mode-hook 'turn-on-auto-fill)
(add-hook 'TeX-after-compilation-finished-functions (add-hook 'TeX-after-compilation-finished-functions
#'TeX-revert-document-buffer) #'TeX-revert-document-buffer)
:config :config
(setq TeX-auto-save t) (setq TeX-auto-save t)
(setq TeX-parse-self t) (setq TeX-parse-self t)
@ -784,10 +799,11 @@ Automatically use smart quotes. (Cant be set to =text-mode-hook=, unfortunate
(use-package typo (use-package typo
:custom :custom
(typo-global-mode 1) (typo-global-mode 1)
:init :hook
(add-hook 'org-mode-hook 'typo-mode) (org-mode . typo-mode)
(add-hook 'markdown-mode-hook 'typo-mode)) (markdown-mode . typo-mode))
(defun unsmart-hook () (defun unsmart-hook ()
"Turn off smart quotes for source blocks within org mode"
(add-hook 'typo-disable-electricity-functions 'org-in-src-block-p nil :local)) (add-hook 'typo-disable-electricity-functions 'org-in-src-block-p nil :local))
(add-hook 'org-mode-hook 'unsmart-hook) (add-hook 'org-mode-hook 'unsmart-hook)
#+END_SRC #+END_SRC
@ -867,9 +883,7 @@ Use Noto fonts to match my system fonts on Linux. This has to be done differentl
'(default ((t (:family "Noto Mono" :foundry "outline" :slant normal :weight normal :height 98 :width normal)))) '(default ((t (:family "Noto Mono" :foundry "outline" :slant normal :weight normal :height 98 :width normal))))
'(italic ((t (:slant italic)))) '(italic ((t (:slant italic))))
'(variable-pitch ((t (:family "Noto Sans" :height 90)))) '(variable-pitch ((t (:family "Noto Sans" :height 90))))
'(fixed-pitch ((t (:family "Noto Mono" :height 90)))))) '(fixed-pitch ((t (:family "Noto Mono" :height 90)))))
(unless (iswin)
(custom-set-faces (custom-set-faces
'(italic ((t (:slant italic)))) '(italic ((t (:slant italic))))
'(variable-pitch ((t (:family "Noto Sans" :height 90)))) '(variable-pitch ((t (:family "Noto Sans" :height 90))))

@ -3,13 +3,14 @@
(setq dw-username "tobli") (setq dw-username "tobli")
(setq dw-pin "0397") (setq dw-pin "0397")
(setq dw-defaultlocation "🔺") (setq dw-defaultlocation "🔺")
(setq dw-iconfile "~/Documents/drive/org/iconchoose.el") (setq dw-iconfile "~/Documents/drive/admin/emacs/iconchoose.el")
(setq lastfm-login t) ;; boolean (setq lastfm-login t) ;; boolean
(setq lastfm-user "litrovers") (setq lastfm-user "litrovers")
;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;
(defun dwexport () (defun dwexport ()
"Export HTML for DW posting"
(let ((org-export-with-author 'nil) (let ((org-export-with-author 'nil)
(org-export-with-creator 'nil) (org-export-with-creator 'nil)
(org-export-with-date 'nil) (org-export-with-date 'nil)
@ -31,6 +32,7 @@
(write-file newname))) (write-file newname)))
(defun dwdraft () (defun dwdraft ()
"Export HTML for DW posting and copy it to the clipboard"
(interactive) (interactive)
(dwexport) (dwexport)
(with-current-buffer newname (with-current-buffer newname
@ -40,6 +42,7 @@
(delete-file newname))) (delete-file newname)))
(defun dwsecurity () (defun dwsecurity ()
"Set security level for DW post"
(setq security (completing-read-multiple "Security (public, access, private): " '("public" "access" "private"))) (setq security (completing-read-multiple "Security (public, access, private): " '("public" "access" "private")))
(if (not security) (if (not security)
(setq security "skip")) (setq security "skip"))
@ -52,6 +55,7 @@
(substring securityjunk 2 end))"\n")))) (substring securityjunk 2 end))"\n"))))
(defun dwmood () (defun dwmood ()
"Set mood for DW post"
(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 (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")))
(if (not mood) (if (not mood)
(setq mood "skip")) (setq mood "skip"))
@ -64,6 +68,7 @@
(substring moodjunk 2 end))"\n")))) (substring moodjunk 2 end))"\n"))))
(defun dwmusic () (defun dwmusic ()
"Set current music for DW post"
(setq music (lastfm-user-get-recent-tracks :user lastfm-user :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)) (setq music (replace-regexp-in-string (regexp-quote "\" \"") " " (format "%S" music) nil 'literal))
(sleep-for 1) (sleep-for 1)
@ -78,6 +83,7 @@
(substring musicjunk 4 end))"\n")))) (substring musicjunk 4 end))"\n"))))
(defun dwicon (thefile) (defun dwicon (thefile)
"Set icon for DW post"
(setq icon "skip") (setq icon "skip")
(load-file dw-iconfile) (load-file dw-iconfile)
(with-current-buffer thefile (with-current-buffer thefile
@ -87,26 +93,31 @@
(insert (concat "post-icon: "icon "\n")))) (insert (concat "post-icon: "icon "\n"))))
(defun dwlocation () (defun dwlocation ()
"Set location for DW post"
(setq location (read-string "Location: " dw-defaultlocation)) (setq location (read-string "Location: " dw-defaultlocation))
(if (equal location "") (if (equal location "")
(sleep-for 0) (sleep-for 0)
(insert (concat "post-location: " location "\n")))) (insert (concat "post-location: " location "\n"))))
(defun dwmusic-manual () (defun dwmusic-manual ()
"Set current music for DW post if lastfm.el not set up"
(setq music (read-string "Music: ")) (setq music (read-string "Music: "))
(if (equal music "") (if (equal music "")
(sleep-for 0) (sleep-for 0)
(insert (concat "post-music: " music "\n")))) (insert (concat "post-music: " music "\n"))))
(defun dw-posted () (defun dw-posted ()
"Log DW post"
(find-file-noselect "~/Documents/drive/org/calendar/habit.org") (find-file-noselect "~/Documents/drive/org/calendar/habit.org")
(with-current-buffer "habit.org" (with-current-buffer "habit.org"
(goto-char (point-min)) (goto-char (point-min))
(re-search-forward "RECUR dw posts") (re-search-forward "RECUR dw posts")
(org-shiftright) (org-shiftright)
(sleep-for 1)
(save-buffer))) (save-buffer)))
(defun dwpost (psubject tags) (defun dwpost (psubject tags)
"Post to DW"
(interactive (list (read-string "Post title (REQUIRED): ") (interactive (list (read-string "Post title (REQUIRED): ")
(read-string "Tags (comma-separated): "))) (read-string "Tags (comma-separated): ")))
(dwexport) (dwexport)

@ -1,29 +1,26 @@
(defun dwuser () (defun dwuser ()
"Insert HTML link to a DW personal account"
(interactive) (interactive)
(setq theuser (read-string "DW username: ")) (setq theuser (read-string "DW username: "))
(insert (concat "<span style=\"white-space: nowrap;\" class=\"ljuser\"><a href=\"https://" theuser ".dreamwidth.org/profile\"><img src=\"https://www.dreamwidth.org/img/silk/identity/user.png\" alt=\"[personal profile]\" width=\"17\" height=\"17\" style=\"vertical-align: text-bottom; border: 0; padding-right: 1px;\" /></a><a href=\"https://" theuser ".dreamwidth.org/\"><b>" theuser "</b></a></span>"))) (setq ao3 (y-or-n-p "For AO3?"))
(if ao3
(insert (concat "<a href=\"https://" theuser ".dreamwidth.org/profile\" rel=\"nofollow\"><img src=\"https://www.dreamwidth.org/img/silk/identity/user.png\" width=\"17\" height=\"17\" /></a><b><a href=\"https://" theuser ".dreamwidth.org\" rel=\"nofollow\">" theuser "</a></b>"))
(insert (concat "<span style=\"white-space: nowrap;\" class=\"ljuser\"><a href=\"https://" theuser ".dreamwidth.org/profile\"><img src=\"https://www.dreamwidth.org/img/silk/identity/user.png\" alt=\"[personal profile]\" width=\"17\" height=\"17\" style=\"vertical-align: text-bottom; border: 0; padding-right: 1px;\" /></a><a href=\"https://" theuser ".dreamwidth.org/\"><b>" theuser "</b></a></span>"))))
(defun dwcomm () (defun dwcomm ()
"Insert HTML link to a DW community"
(interactive) (interactive)
(setq theuser (read-string "DW comm name: ")) (setq theuser (read-string "DW comm name: "))
(insert (concat "<span style=\"white-space: nowrap;\" class=\"ljuser\"><a href=\"https://" theuser ".dreamwidth.org/profile\"><img src=\"https://www.dreamwidth.org/img/silk/identity/community.png\" alt=\"[community profile]\" width=\"17\" height=\"17\" style=\"vertical-align: text-bottom; border: 0; padding-right: 1px;\" /></a><a href=\"https://" theuser ".dreamwidth.org/\"><b>" theuser "</b></a></span>"))) (setq ao3 (y-or-n-p "For AO3?"))
(if ao3
(insert (concat "<a href=\"https://" theuser ".dreamwidth.org/profile\" rel=\"nofollow\"><img src=\"https://www.dreamwidth.org/img/silk/identity/community.png\" width=\"17\" height=\"17\" /></a><b><a href=\"https://" theuser ".dreamwidth.org\" rel=\"nofollow\">" theuser "</a></b>"))
(insert (concat "<span style=\"white-space: nowrap;\" class=\"ljuser\"><a href=\"https://" theuser ".dreamwidth.org/profile\"><img src=\"https://www.dreamwidth.org/img/silk/identity/community.png\" alt=\"[community profile]\" width=\"17\" height=\"17\" style=\"vertical-align: text-bottom; border: 0; padding-right: 1px;\" /></a><a href=\"https://" theuser ".dreamwidth.org/\"><b>" theuser "</b></a></span>"))))
(defun ao3user () (defun ao3user ()
"Insert HTML link to an AO3 user"
(interactive) (interactive)
(setq theuser (read-string "AO3 username: ")) (setq theuser (read-string "AO3 username: "))
(insert (concat "<span style=\"white-space: nowrap;\" class=\"ljuser\"><a href=\"https://archiveofourown.org/users/" theuser "/profile\"><img src=\"https://p.dreamwidth.org/b164c54b26e4/-/archiveofourown.org/favicon.ico\" alt=\"[archiveofourown.org profile]\" width=\"16\" height=\"16\" style=\"vertical-align: text-bottom; border: 0; padding-right: 1px;\" /></a><a href=\"https://archiveofourown.org/users/" theuser "\"><b>" theuser "</b></a></span>"))) (setq ao3 (y-or-n-p "For AO3?"))
(if ao3
(defun ao3safe-dwuser () (insert (concat "<a href=\"https://archiveofourown.org/users/" theuser "/profile\" rel=\"nofollow\"><img src=\"https://p.dreamwidth.org/b164c54b26e4/-/archiveofourown.org/favicon.ico\" width=\"16\" height=\"16\" /></a><b><a href=\"https://archiveofourown.org/users/" theuser "\" rel=\"nofollow\">" theuser "</a></b>"))
(interactive) (insert (concat "<span style=\"white-space: nowrap;\" class=\"ljuser\"><a href=\"https://archiveofourown.org/users/" theuser "/profile\"><img src=\"https://p.dreamwidth.org/b164c54b26e4/-/archiveofourown.org/favicon.ico\" alt=\"[archiveofourown.org profile]\" width=\"16\" height=\"16\" style=\"vertical-align: text-bottom; border: 0; padding-right: 1px;\" /></a><a href=\"https://archiveofourown.org/users/" theuser "\"><b>" theuser "</b></a></span>"))))
(setq theuser (read-string "DW username: "))
(insert (concat "<a href=\"https://" theuser ".dreamwidth.org/profile\" rel=\"nofollow\"><img src=\"https://www.dreamwidth.org/img/silk/identity/user.png\" width=\"17\" height=\"17\" /></a><b><a href=\"https://" theuser ".dreamwidth.org\" rel=\"nofollow\">" theuser "</a></b>")))
(defun ao3safe-dwcomm ()
(interactive)
(setq theuser (read-string "DW comm name: "))
(insert (concat "<a href=\"https://" theuser ".dreamwidth.org/profile\" rel=\"nofollow\"><img src=\"https://www.dreamwidth.org/img/silk/identity/community.png\" width=\"17\" height=\"17\" /></a><b><a href=\"https://" theuser ".dreamwidth.org\" rel=\"nofollow\">" theuser "</a></b>")))
(defun ao3safe-ao3user ()
(interactive)
(setq theuser (read-string "AO3 username: "))
(insert (concat "<a href=\"https://archiveofourown.org/users/" theuser "/profile\" rel=\"nofollow\"><img src=\"https://p.dreamwidth.org/b164c54b26e4/-/archiveofourown.org/favicon.ico\" width=\"16\" height=\"16\" /></a><b><a href=\"https://archiveofourown.org/users/" theuser "\" rel=\"nofollow\">" theuser "</a></b>")))

@ -1,4 +1,5 @@
(defun fic-ao3 () (defun fic-ao3 ()
"Format fic for posting to AO3 and export it"
(interactive) (interactive)
(org-format) (org-format)
(save-buffer) (save-buffer)
@ -44,6 +45,7 @@
(delete-file newname))) (delete-file newname)))
(defun fic-export () (defun fic-export ()
"Export fic to HTML, EPUB, PDF"
(interactive) (interactive)
(shell-command "cp ~/.emacs.d/fic-export-files/FFXYevon.ttf .") (shell-command "cp ~/.emacs.d/fic-export-files/FFXYevon.ttf .")
(setq asal (y-or-n-p "ASAL?")) (setq asal (y-or-n-p "ASAL?"))

@ -1,4 +1,5 @@
(defun red () (defun red ()
"Set exported HTML file to red"
(interactive) (interactive)
(setq oldname (concat (file-name-base) ".org")) (setq oldname (concat (file-name-base) ".org"))
(setq newname (concat (file-name-base) ".html")) (setq newname (concat (file-name-base) ".html"))
@ -9,6 +10,7 @@
(write-file newname))) (write-file newname)))
(defun blue () (defun blue ()
"Set exported HTML file to blue"
(interactive) (interactive)
(setq oldname (concat (file-name-base) ".org")) (setq oldname (concat (file-name-base) ".org"))
(setq newname (concat (file-name-base) ".html")) (setq newname (concat (file-name-base) ".html"))
@ -19,6 +21,7 @@
(write-file newname))) (write-file newname)))
(defun green () (defun green ()
"Set exported HTML file to green"
(interactive) (interactive)
(setq oldname (concat (file-name-base) ".org")) (setq oldname (concat (file-name-base) ".org"))
(setq newname (concat (file-name-base) ".html")) (setq newname (concat (file-name-base) ".html"))

@ -1,4 +1,5 @@
(defun org-format () (defun org-format ()
"Correct formatting in an org file"
(interactive) (interactive)
(goto-char (point-min)) (goto-char (point-min))
(while (re-search-forward " -" nil t) (while (re-search-forward " -" nil t)

@ -1,5 +1,6 @@
(defun periodise () (defun periodise ()
(setq periodfile "~/Documents/drive/org/period.org") "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
@ -17,8 +18,9 @@
(insert (concat "Day " (format "%S" days)))) (insert (concat "Day " (format "%S" days))))
(defun menstruate () (defun menstruate ()
"Mark beginning of menstrual cycle"
(interactive) (interactive)
(setq periodfile "~/Documents/drive/org/period.org") (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,4 @@
(setq daysoff '("2022-12-23" "2022-12-24" "2022-12-25" "2022-12-26" "2022-12-27" "2022-12-28" "2022-12-29" "2022-12-30" "2022-12-31" "2023-01-01" "2023-01-02" "2023-01-03" "2023-03-17" "2023-04-07" "2023-04-14" "2023-05-01" "2023-05-08" "2023-07-12" "2023-07-13" "2023-12-22" "2023-12-23" "2023-12-24" "2023-12-25" "2023-12-26" "2023-12-27" "2023-12-28" "2023-12-29" "2023-12-30" "2023-12-31" "2023-01-01" "2023-01-02" "2024-03-18" "2024-03-29" "2024-03-30" "2024-03-31" "2024-04-01" "2024-04-02" "2024-04-03" "2024-04-04" "2024-04-05" "2024-05-06" "2024-07-12" "2024-07-15" "2024-12-23" "2024-12-24" "2024-12-25" "2024-12-26" "2024-12-27" "2024-12-28" "2024-12-29" "2024-12-30" "2024-12-31" "2025-01-01")) ;; to update in 2025 (load-file "~/Documents/drive/admin/emacs/daysoff.el")
(if (equal (format-time-string "%a") "Sat") (if (equal (format-time-string "%a") "Sat")
(setq workday nil) (setq workday nil)
(if (equal (format-time-string "%a") "Sun") (if (equal (format-time-string "%a") "Sun")
@ -6,7 +6,3 @@
(if (member (format-time-string "%Y-%m-%d") daysoff) (if (member (format-time-string "%Y-%m-%d") daysoff)
(setq workday nil) (setq workday nil)
(setq workday t)))) (setq workday t))))
(defun isworkday ()
(eq workday t))

@ -0,0 +1,4 @@
# name: fanfiction-link
# key: ficlink
# --
<a href="$1">$2</a>$0&nbsp;<code>$3</code>

@ -0,0 +1,10 @@
# name: summary-details
# key: sumdet
# --
<details><summary>$1</summary>
$2
</details>
$0

@ -78,7 +78,7 @@ urlseen={Accessed},
} }
\bibliography{`(with-temp-buffer \bibliography{`(with-temp-buffer
(insert-file-contents "~/Documents/drive/org/bibpath") (insert-file-contents "~/Documents/drive/admin/emacs/bibpath")
(buffer-string))`} (buffer-string))`}
$0 $0

@ -1,4 +0,0 @@
# name: ao3-user
# key: ao3user
# --
@@html:<user name="$1" site="ao3">@@$0

@ -1,10 +0,0 @@
# name: html-head
# key: hhead
# --
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="`(expand-file-name "~/.emacs.d/export.css")`" />
#+HTML_HEAD_EXTRA: <link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Fredoka+One|Raleway:400,400i,800|Share+Tech+Mono" />
#+INFOJS_OPT: view:showall toc:nil ltoc:nil
#+OPTIONS: num:nil
#+TITLE: $1
$0

@ -0,0 +1,4 @@
# name: site-user
# key: siteuser
# --
@@html:<user name="$1" site="$2">@@$0
Loading…
Cancel
Save