@ -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
* 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.
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"
"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 I’ m on, also whether I’ m at work or no
(string-equal user-login-name "3055822"))
(string-equal user-login-name "3055822"))
#+END_SRC
#+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
* 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 I’ m using the boring Windows desktop.
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
#+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 don’ t know if I’ ll ever use macOS again, but in case I do, I need the meta key to work.
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
#+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 don’ t 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 " " " " text)))
(replace-regexp-in-string " " " " 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 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.
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
#+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 (is workday)
(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 it’ s 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 it’ s 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. (Can’ t 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))))