General cleanup: reorganising snippets, tidying if statements, documenting functions
This commit is contained in:
parent
18c64c71c4
commit
4aa4de17f5
30 changed files with 128 additions and 99 deletions
|
@ -1,5 +1,6 @@
|
|||
(load-file "~/.emacs.d/agenda-common.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")) 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"))
|
||||
|
@ -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-prefix-format '((agenda . "%?-12t%s")))
|
||||
;; (setq org-deadline-warning-days 0)
|
||||
(load-file "~/.emacs.d/agenda-common.el")
|
||||
|
|
124
config.org
124
config.org
|
@ -1,15 +1,3 @@
|
|||
* =$whoami=, a big neckbeard, that’s 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
|
||||
|
||||
Define functions that specify what OS I’m on, also whether I’m at work or not. Then I can implement specific packages according to need/compatibility.
|
||||
|
@ -23,7 +11,7 @@ Define functions that specify what OS I’m on, also whether I’m at work or no
|
|||
"Return true if on windows"
|
||||
(string-equal system-type "windows-nt"))
|
||||
|
||||
(defun ismac ()
|
||||
(defun ismac () ;; unkikely now, but might as well keep this
|
||||
"Return true if on macos"
|
||||
(string-equal system-type "darwin"))
|
||||
|
||||
|
@ -32,6 +20,16 @@ Define functions that specify what OS I’m on, also whether I’m at work or no
|
|||
(string-equal user-login-name "3055822"))
|
||||
#+END_SRC
|
||||
|
||||
* =$whoami=, a big neckbeard, that’s who
|
||||
|
||||
Set name and location based on who I’m 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
|
||||
|
||||
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)
|
||||
(set-default-coding-systems 'utf-8)
|
||||
(set-language-environment 'utf-8)
|
||||
(unless (iswin) (set-selection-coding-system 'utf-8))
|
||||
(when (iswin) (set-selection-coding-system 'utf-16-le))
|
||||
(if (iswin)
|
||||
(set-selection-coding-system 'utf-16-le)
|
||||
(set-selection-coding-system 'utf-8))
|
||||
#+END_SRC
|
||||
|
||||
* 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
|
||||
|
||||
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
|
||||
(defun load-directory (dir)
|
||||
"Add all files in a directory to load-path"
|
||||
(let ((load-it (lambda (f)
|
||||
(load-file (concat (file-name-as-directory dir) f)))))
|
||||
(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)
|
||||
(tool-bar-mode -1)
|
||||
(scroll-bar-mode -1)
|
||||
(tooltip-mode -1)
|
||||
#+END_SRC
|
||||
|
||||
Make everything just a little tiny bit transparent unless I’m 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
|
||||
(defun er-auto-create-missing-dirs ()
|
||||
"Make new directories automatically"
|
||||
(let ((target-dir (file-name-directory buffer-file-name)))
|
||||
(unless (file-exists-p target-dir)
|
||||
(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
|
||||
(when (islin)
|
||||
(setq browse-url-browser-function 'browse-url-generic
|
||||
browse-url-generic-program "google-chrome"
|
||||
))
|
||||
browse-url-generic-program "google-chrome"))
|
||||
#+END_SRC
|
||||
|
||||
Honestly I don’t know if I’ll 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
|
||||
(defun elfeed-load-db-and-open ()
|
||||
"Load and open the elfeed DB"
|
||||
(interactive)
|
||||
(elfeed-db-load)
|
||||
(elfeed)
|
||||
|
@ -311,13 +313,15 @@ Standard =elfeed= settings:
|
|||
'(define-key elfeed-search-mode-map (kbd "m") 'elfeed-toggle-star))
|
||||
|
||||
(defun elfeed-save-db-and-bury ()
|
||||
"Save and close the elfeed DB"
|
||||
(interactive)
|
||||
(elfeed-db-save)
|
||||
(quit-window))
|
||||
|
||||
(use-package elfeed
|
||||
:bind (:map elfeed-search-mode-map
|
||||
("q" . elfeed-save-db-and-bury))
|
||||
:bind
|
||||
(:map elfeed-search-mode-map
|
||||
("q" . elfeed-save-db-and-bury))
|
||||
:custom
|
||||
(elfeed-sort-order 'ascending)
|
||||
(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
|
||||
(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)))
|
||||
#+END_SRC
|
||||
|
||||
|
@ -342,6 +347,7 @@ Save elfeed state properly when exiting Emacs.
|
|||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun save-if-elfeed ()
|
||||
"Save the elfeed DB if elfeed is running"
|
||||
(if (get-buffer "*elfeed-search*")
|
||||
(progn
|
||||
(elfeed-db-save)
|
||||
|
@ -373,7 +379,7 @@ This works only for =emacs27= and above, and I don’t want to use it at work, s
|
|||
#+BEGIN_SRC emacs-lisp
|
||||
(unless (version< emacs-version "27")
|
||||
(unless (atwork)
|
||||
(use-package lastfm)))
|
||||
(use-package lastfm)))
|
||||
#+END_SRC
|
||||
|
||||
** =markdown-mode=
|
||||
|
@ -385,8 +391,8 @@ I kind of hate markdown but I still have to use it sometimes.
|
|||
:mode (("README\\.md\\'" . gfm-mode)
|
||||
("\\.md\\'" . markdown-mode)
|
||||
("\\.markdown\\'" . markdown-mode))
|
||||
:init
|
||||
(add-hook 'markdown-mode-hook 'auto-fill-mode)
|
||||
:hook
|
||||
(markdown-mode . auto-fill-mode)
|
||||
:config
|
||||
(setq markdown-asymmetric-header t)
|
||||
:custom
|
||||
|
@ -439,6 +445,7 @@ For reading ebooks. Only on Linux because I (supposedly) use it with my calibre
|
|||
:init
|
||||
(add-to-list 'auto-mode-alist '("\\.epub\\'" . nov-mode)))
|
||||
(defun my-nov-font-setup ()
|
||||
"Set the font for nov-mode"
|
||||
(face-remap-add-relative 'variable-pitch :family "Liberation Serif"
|
||||
:height 2.0))
|
||||
(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
|
||||
(unless (version< emacs-version "27")
|
||||
(defun my-html-filter-nobreaks (text backend info)
|
||||
"Keep non-breaking spaces in HTML org export"
|
||||
(when (org-export-derived-backend-p backend 'html)
|
||||
(replace-regexp-in-string " " " " text)))
|
||||
(add-to-list 'org-export-filter-plain-text-functions
|
||||
'my-html-filter-nobreaks)
|
||||
(defun my-latex-filter-nobreaks (text backend info)
|
||||
"Keep non-breaking spaces in LaTeX org export"
|
||||
(when (org-export-derived-backend-p backend 'latex)
|
||||
(replace-regexp-in-string " " "~" text)))
|
||||
(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
|
||||
(unless (atwork)
|
||||
(defun org-journal-file-header-func (time)
|
||||
"Set the header for org-journal files"
|
||||
(concat "<" (format-time-string "%Y-%m-%d %a") ">\n\n"))
|
||||
(use-package org-journal
|
||||
:bind ("C-c j" . org-journal-new-entry)
|
||||
:bind
|
||||
("C-c j" . org-journal-new-entry)
|
||||
:config
|
||||
(setq org-journal-dir "~/Documents/drive/org/journal")
|
||||
(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 I’m 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
|
||||
(unless (version< emacs-version "27")
|
||||
(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)))
|
||||
|
||||
(if (version< emacs-version "27")
|
||||
(if (version< emacs-version "27")
|
||||
(progn
|
||||
(use-package org-bullets
|
||||
:custom
|
||||
(org-bullets-bullet-list '("✸"))
|
||||
(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
|
||||
|
||||
**** =org-noter=
|
||||
|
@ -610,7 +622,8 @@ Display the file outline in a sidebar.
|
|||
#+BEGIN_SRC emacs-lisp
|
||||
(unless (version< emacs-version "27")
|
||||
(use-package org-sidebar
|
||||
:bind ("C-c C-x s" . org-sidebar-tree)))
|
||||
:bind
|
||||
("C-c C-x s" . org-sidebar-tree)))
|
||||
#+END_SRC
|
||||
|
||||
**** =org-wc=
|
||||
|
@ -620,7 +633,8 @@ Display word counts next to org headings.
|
|||
#+BEGIN_SRC emacs-lisp
|
||||
(unless (version< emacs-version "27")
|
||||
(use-package org-wc
|
||||
:bind ("C-c C-x w" . org-wc-display)))
|
||||
:bind
|
||||
("C-c C-x w" . org-wc-display)))
|
||||
#+END_SRC
|
||||
|
||||
*** Agenda settings
|
||||
|
@ -645,7 +659,7 @@ Set the files to be included.
|
|||
(add-to-list 'org-agenda-files "~/Documents/drive/org/calendar/acwri.org"))
|
||||
(progn
|
||||
(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")) 7)
|
||||
(progn
|
||||
|
@ -679,8 +693,8 @@ Add period information to the agenda header (this has a very weird output, compl
|
|||
#+BEGIN_SRC emacs-lisp
|
||||
(setq org-agenda-custom-commands
|
||||
'(("a" "Slightly modified agenda view"
|
||||
((agenda ""
|
||||
((org-agenda-overriding-header (periodise))))))))
|
||||
((agenda ""
|
||||
((org-agenda-overriding-header (periodise))))))))
|
||||
#+END_SRC
|
||||
|
||||
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 it’s indispensable anyway.
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(unless (iswin) (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)))
|
||||
|
||||
(when (iswin) (use-package doc-view
|
||||
(if (iswin)
|
||||
(use-package doc-view
|
||||
: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
|
||||
|
||||
** =rainbow-mode=
|
||||
|
@ -745,7 +759,8 @@ Gives me a dialog with recently opened files. Package management and =elfeed= st
|
|||
(recentf-mode 1)
|
||||
(setq recentf-max-menu-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
|
||||
(expand-file-name "~/.emacs.d/elpa/*"))
|
||||
(add-to-list 'recentf-exclude
|
||||
|
@ -765,7 +780,7 @@ As previously described, “the big boy”. I know little about most of these se
|
|||
:init
|
||||
(add-hook 'LaTeX-mode-hook 'turn-on-auto-fill)
|
||||
(add-hook 'TeX-after-compilation-finished-functions
|
||||
#'TeX-revert-document-buffer)
|
||||
#'TeX-revert-document-buffer)
|
||||
:config
|
||||
(setq TeX-auto-save t)
|
||||
(setq TeX-parse-self t)
|
||||
|
@ -784,10 +799,11 @@ Automatically use smart quotes. (Can’t be set to =text-mode-hook=, unfortunate
|
|||
(use-package typo
|
||||
:custom
|
||||
(typo-global-mode 1)
|
||||
:init
|
||||
(add-hook 'org-mode-hook 'typo-mode)
|
||||
(add-hook 'markdown-mode-hook 'typo-mode))
|
||||
:hook
|
||||
(org-mode . typo-mode)
|
||||
(markdown-mode . typo-mode))
|
||||
(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 'org-mode-hook 'unsmart-hook)
|
||||
#+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))))
|
||||
'(italic ((t (:slant italic))))
|
||||
'(variable-pitch ((t (:family "Noto Sans" :height 90))))
|
||||
'(fixed-pitch ((t (:family "Noto Mono" :height 90))))))
|
||||
|
||||
(unless (iswin)
|
||||
'(fixed-pitch ((t (:family "Noto Mono" :height 90)))))
|
||||
(custom-set-faces
|
||||
'(italic ((t (:slant italic))))
|
||||
'(variable-pitch ((t (:family "Noto Sans" :height 90))))
|
||||
|
|
|
@ -3,13 +3,14 @@
|
|||
(setq dw-username "tobli")
|
||||
(setq dw-pin "0397")
|
||||
(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-user "litrovers")
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defun dwexport ()
|
||||
"Export HTML for DW posting"
|
||||
(let ((org-export-with-author 'nil)
|
||||
(org-export-with-creator 'nil)
|
||||
(org-export-with-date 'nil)
|
||||
|
@ -31,6 +32,7 @@
|
|||
(write-file newname)))
|
||||
|
||||
(defun dwdraft ()
|
||||
"Export HTML for DW posting and copy it to the clipboard"
|
||||
(interactive)
|
||||
(dwexport)
|
||||
(with-current-buffer newname
|
||||
|
@ -40,6 +42,7 @@
|
|||
(delete-file newname)))
|
||||
|
||||
(defun dwsecurity ()
|
||||
"Set security level for DW post"
|
||||
(setq security (completing-read-multiple "Security (public, access, private): " '("public" "access" "private")))
|
||||
(if (not security)
|
||||
(setq security "skip"))
|
||||
|
@ -52,6 +55,7 @@
|
|||
(substring securityjunk 2 end))"\n"))))
|
||||
|
||||
(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")))
|
||||
(if (not mood)
|
||||
(setq mood "skip"))
|
||||
|
@ -64,6 +68,7 @@
|
|||
(substring moodjunk 2 end))"\n"))))
|
||||
|
||||
(defun dwmusic ()
|
||||
"Set current music for DW post"
|
||||
(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)
|
||||
|
@ -78,6 +83,7 @@
|
|||
(substring musicjunk 4 end))"\n"))))
|
||||
|
||||
(defun dwicon (thefile)
|
||||
"Set icon for DW post"
|
||||
(setq icon "skip")
|
||||
(load-file dw-iconfile)
|
||||
(with-current-buffer thefile
|
||||
|
@ -87,26 +93,31 @@
|
|||
(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)
|
||||
(save-buffer)))
|
||||
|
||||
(defun dwpost (psubject tags)
|
||||
"Post to DW"
|
||||
(interactive (list (read-string "Post title (REQUIRED): ")
|
||||
(read-string "Tags (comma-separated): ")))
|
||||
(dwexport)
|
||||
|
|
|
@ -1,29 +1,26 @@
|
|||
(defun dwuser ()
|
||||
"Insert HTML link to a DW personal account"
|
||||
(interactive)
|
||||
(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 ()
|
||||
"Insert HTML link to a DW community"
|
||||
(interactive)
|
||||
(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 ()
|
||||
"Insert HTML link to an AO3 user"
|
||||
(interactive)
|
||||
(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>")))
|
||||
|
||||
(defun ao3safe-dwuser ()
|
||||
(interactive)
|
||||
(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>")))
|
||||
(setq ao3 (y-or-n-p "For AO3?"))
|
||||
(if ao3
|
||||
(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>"))
|
||||
(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>"))))
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
(defun fic-ao3 ()
|
||||
"Format fic for posting to AO3 and export it"
|
||||
(interactive)
|
||||
(org-format)
|
||||
(save-buffer)
|
||||
|
@ -44,6 +45,7 @@
|
|||
(delete-file newname)))
|
||||
|
||||
(defun fic-export ()
|
||||
"Export fic to HTML, EPUB, PDF"
|
||||
(interactive)
|
||||
(shell-command "cp ~/.emacs.d/fic-export-files/FFXYevon.ttf .")
|
||||
(setq asal (y-or-n-p "ASAL?"))
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
(defun red ()
|
||||
"Set exported HTML file to red"
|
||||
(interactive)
|
||||
(setq oldname (concat (file-name-base) ".org"))
|
||||
(setq newname (concat (file-name-base) ".html"))
|
||||
|
@ -9,6 +10,7 @@
|
|||
(write-file newname)))
|
||||
|
||||
(defun blue ()
|
||||
"Set exported HTML file to blue"
|
||||
(interactive)
|
||||
(setq oldname (concat (file-name-base) ".org"))
|
||||
(setq newname (concat (file-name-base) ".html"))
|
||||
|
@ -19,6 +21,7 @@
|
|||
(write-file newname)))
|
||||
|
||||
(defun green ()
|
||||
"Set exported HTML file to green"
|
||||
(interactive)
|
||||
(setq oldname (concat (file-name-base) ".org"))
|
||||
(setq newname (concat (file-name-base) ".html"))
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
(defun org-format ()
|
||||
"Correct formatting in an org file"
|
||||
(interactive)
|
||||
(goto-char (point-min))
|
||||
(while (re-search-forward " -" nil t)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
(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)
|
||||
(setq thebuffer (file-name-nondirectory periodfile))
|
||||
(with-current-buffer thebuffer
|
||||
|
@ -17,8 +18,9 @@
|
|||
(insert (concat "Day " (format "%S" days))))
|
||||
|
||||
(defun menstruate ()
|
||||
"Mark beginning of menstrual cycle"
|
||||
(interactive)
|
||||
(setq periodfile "~/Documents/drive/org/period.org")
|
||||
(setq periodfile "~/Documents/drive/admin/emacs/period.org")
|
||||
(find-file-noselect periodfile)
|
||||
(setq thebuffer (file-name-nondirectory periodfile))
|
||||
(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")
|
||||
(setq workday nil)
|
||||
(if (equal (format-time-string "%a") "Sun")
|
||||
|
@ -6,7 +6,3 @@
|
|||
(if (member (format-time-string "%Y-%m-%d") daysoff)
|
||||
(setq workday nil)
|
||||
(setq workday t))))
|
||||
|
||||
(defun isworkday ()
|
||||
(eq workday t))
|
||||
|
||||
|
|
4
snippets/html-mode/ficlink
Normal file
4
snippets/html-mode/ficlink
Normal file
|
@ -0,0 +1,4 @@
|
|||
# name: fanfiction-link
|
||||
# key: ficlink
|
||||
# --
|
||||
<a href="$1">$2</a>$0 <code>$3</code>
|
10
snippets/html-mode/sumdet
Normal file
10
snippets/html-mode/sumdet
Normal file
|
@ -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
|
||||
(insert-file-contents "~/Documents/drive/org/bibpath")
|
||||
(insert-file-contents "~/Documents/drive/admin/emacs/bibpath")
|
||||
(buffer-string))`}
|
||||
|
||||
$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
|
4
snippets/org-mode/siteuser
Normal file
4
snippets/org-mode/siteuser
Normal file
|
@ -0,0 +1,4 @@
|
|||
# name: site-user
|
||||
# key: siteuser
|
||||
# --
|
||||
@@html:<user name="$1" site="$2">@@$0
|
Loading…
Add table
Add a link
Reference in a new issue