@ -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,12 +313,14 @@ 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
:bind
(:map elfeed-search-mode-map
("q" . elfeed-save-db-and-bury))
:custom
(elfeed-sort-order 'ascending)
@ -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)
@ -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")
(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 (is workday)
(if workday
(if (< (string-to-number (format-time-string "%H")) 19)
(if (> (string-to-number (format-time-string "%H")) 7)
(progn
@ -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
(if (iswin)
(use-package doc-view
:config
(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)))
(when (iswin) (use-package doc-view
:config
(setq doc-view-ghostscript-program "gswin32c")))
#+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
@ -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))))