summaryrefslogtreecommitdiff
path: root/config/emacs.org
diff options
context:
space:
mode:
authorPreston Pan <ret2pop@nullring.xyz>2026-03-25 20:06:26 -0700
committerPreston Pan <ret2pop@nullring.xyz>2026-03-25 20:06:26 -0700
commitd79e97256cb01e33c47822859e171161352fb7c9 (patch)
treec7c03b4eae03d52923a21833920e1b1523a35af4 /config/emacs.org
parent42656b6d8e9d433ee9a032605755679157980365 (diff)
add qtile configuration
Diffstat (limited to 'config/emacs.org')
-rw-r--r--config/emacs.org574
1 files changed, 372 insertions, 202 deletions
diff --git a/config/emacs.org b/config/emacs.org
index 29794af..98fe132 100644
--- a/config/emacs.org
+++ b/config/emacs.org
@@ -79,7 +79,7 @@ syntax elsewhere. Generally, however, these are all unordered and not dependent
;; start with sane defaults
(pixel-scroll-precision-mode 1)
- (display-battery-mode 1)
+ ;; (display-battery-mode 1)
(display-time-mode 1)
(menu-bar-mode -1)
(scroll-bar-mode -1)
@@ -89,12 +89,14 @@ syntax elsewhere. Generally, however, these are all unordered and not dependent
;; load theme, fonts, and transparency. Prettify symbols.
(set-face-attribute 'default nil :font "Iosevka Nerd Font" :height 130)
(set-face-attribute 'variable-pitch nil :font "Lora" :height 1.1)
-
+ (set-face-attribute 'alert-urgent-face nil :inherit nil)
(when (display-graphic-p)
- (set-fontset-font t 'han (font-spec :family "Noto Sans CJK SC"))
- (set-fontset-font t 'kana (font-spec :family "Noto Sans CJK JP"))
- (set-fontset-font t 'symbol (font-spec :family "Noto Color Emoji"))
- (set-fontset-font t 'symbol (font-spec :family "Symbols Nerd Font Mono") nil 'append)))
+ (set-fontset-font t 'han (font-spec :family "Noto Sans CJK SC"))
+ (set-fontset-font t 'kana (font-spec :family "Noto Sans CJK JP"))
+ (set-fontset-font t 'emoji (font-spec :family "Noto Color Emoji") nil 'prepend)
+ (set-fontset-font t 'symbol (font-spec :family "Noto Color Emoji") nil 'append)
+ (set-fontset-font t '(#x1f300 . #x1f5ff) (font-spec :family "Noto Color Emoji") nil 'prepend)
+ (set-fontset-font t '(#xe000 . #xf8ff) (font-spec :family "Symbols Nerd Font Mono") nil 'append)))
;; imperative
(defun evil-config ()
@@ -128,14 +130,14 @@ syntax elsewhere. Generally, however, these are all unordered and not dependent
;; taken from blog https://writepermission.com/org-blogging-rss-feed.html
(defun rp/org-rss-publish-to-rss (plist filename pub-dir)
"Publish RSS with PLIST, only when FILENAME is 'rss.org'.
-PUB-DIR is when the output will be placed."
+ PUB-DIR is when the output will be placed."
(if (equal "rss.org" (file-name-nondirectory filename))
(org-rss-publish-to-rss plist filename pub-dir)))
(defun format-rss-feed-entry (entry style project)
"Format ENTRY for the RSS feed.
-ENTRY is a file name. STYLE is either 'list' or 'tree'.
-PROJECT is the current project."
+ ENTRY is a file name. STYLE is either 'list' or 'tree'.
+ PROJECT is the current project."
(cond ((not (directory-name-p entry))
(let* ((file (org-publish--expand-file-name entry project))
(title (org-publish-find-title entry project))
@@ -182,6 +184,106 @@ PROJECT is the current project."
(defun rp/org-sitemap-publish-function (plist filename pub-dir)
(when (string-equal (file-name-nondirectory filename) "sitemap.xml")
(org-publish-attachment plist filename pub-dir)))
+
+(defvar my-mu4e-search-history nil)
+
+(defun my-mu4e-search-with-ivy ()
+ "Search mu4e using the native prompt wrapped in Ivy."
+ (interactive)
+ ;; We use mu4e's own query reader if possible, otherwise fallback
+ (let ((query (completing-read "mu4e search: "
+ my-mu4e-search-history nil nil nil
+ 'my-mu4e-search-history)))
+ (unless (string-blank-p query)
+ (mu4e-search query))))
+
+(defun my-mu4e-narrow-with-ivy ()
+ "Live-preview matches in the current buffer using Ivy,
+then append the typed input to the mu4e database query."
+ (interactive)
+ (let* ((current-query (or (mu4e-last-query) ""))
+ ;; 1. Collect all lines in the current headers buffer for the preview
+ (lines (save-excursion
+ (goto-char (point-min))
+ (let (res)
+ (while (not (eobp))
+ (push (buffer-substring-no-properties
+ (line-beginning-position)
+ (line-end-position))
+ res)
+ (forward-line 1))
+ (reverse res)))))
+
+ ;; 2. Launch Ivy with the collected lines
+ (ivy-read (format "Narrow '%s' with: " current-query)
+ lines
+ :action (lambda (_)
+ ;; 3. IGNORE the selected line (_).
+ ;; Instead, grab exactly what you typed into the prompt.
+ (let ((input ivy-text))
+ (if (string-blank-p input)
+ (message "No narrowing term provided. Canceled.")
+ ;; 4. Combine the old query with your new input and query Xapian
+ (mu4e-search (format "(%s) AND (%s)" current-query input))))))))
+
+(defvar my-current-weather "Fetching weather..."
+ "Stores the latest fetched weather string.")
+
+;; 2. The asynchronous fetch function
+(defun my-fetch-weather-async ()
+ "Fetch weather asynchronously without blocking Emacs."
+ (interactive)
+ (let ((buf (get-buffer-create " *wttr-output*")))
+ (with-current-buffer buf (erase-buffer))
+ (make-process
+ :name "wttr-fetch"
+ :buffer buf
+ :command '("curl" "-s" "--max-time" "2" "wttr.in/?format=3")
+ ;; The sentinel runs when the process finishes (success or fail)
+ :sentinel (lambda (process event)
+ (when (string-match-p "finished" event)
+ (let ((output (with-current-buffer (process-buffer process)
+ (string-trim (buffer-string)))))
+ ;; Validate output just like your old try macro did
+ (if (or (string-blank-p output)
+ (string-match-p "BLOCK FAILED\\|Unknown location\\|<html>" output))
+ (setq my-current-weather "Weather currently unavailable.")
+ (setq my-current-weather output)))
+
+ ;; If the dashboard is visible, refresh it so the new text appears!
+ (when (get-buffer-window "*dashboard*" 'visible)
+ (with-current-buffer "*dashboard*"
+ (dashboard-refresh-buffer))))))))
+
+;; 3. Your new, simplified (and fast!) dashboard widget
+(defun my-dashboard-insert-weather-clock (list-size)
+ "Insert a styled clock and the pre-fetched weather variable."
+ (let ((clock (format-time-string "%I:%M %p • %A, %B %d")))
+ (insert "\n")
+ (insert (propertize clock 'face '(:height 1.5 :weight bold :foreground "#51afef")))
+ (insert "\n\n")
+ ;; Just insert the variable. No network calls happen here.
+ (insert (propertize my-current-weather 'face '(:foreground "#a9a1e1" :weight semi-bold)))
+ (insert "\n\n")))
+
+(defun my-refresh-dashboard-if-visible ()
+ "Refresh the dashboard buffer, but only if it's currently visible in a window."
+ (when (get-buffer-window "*dashboard*" 'visible)
+ (with-current-buffer "*dashboard*"
+ (dashboard-refresh-buffer))))
+
+(defun my-setup-dashboard-timer ()
+ "Start a timer to refresh the dashboard every 60 seconds."
+ ;; Cancel any existing timer first to avoid creating multiple timers
+ (when (timerp my-dashboard-refresh-timer)
+ (cancel-timer my-dashboard-refresh-timer))
+ ;; Run the refresh function every 60 seconds
+ (setq my-dashboard-refresh-timer (run-with-timer 60 60 #'my-refresh-dashboard-if-visible)))
+
+(defun my-fix-htmlize-invalid-face-bug (orig-fn face attribute &optional frame inherit)
+ (if (eq face t)
+ 'unspecified
+ (funcall orig-fn face attribute frame inherit)))
#+end_src
** Random Packages
These are packages that I require in order to write some scripts in emacs-lisp.
@@ -211,6 +313,20 @@ Emacs is self documenting, after all!
(standard-indent 2 "base indentation")
(custom-safe-themes t "I already manage my themes with nix")
(custom-file null-device "Don't save custom configs")
+ (jit-lock-chunk-size 16384 "actually load code blocks")
+ (jit-lock-stealth-time 1.25 "fontify in the background after 1.25s of idle time")
+ (jit-lock-stealth-nice 0.1 "don't freeze Emacs while stealth fontifying")
+ ;; ---------------------------------------------------------------------------
+ ;; UTF-8 Everywhere
+ ;; ---------------------------------------------------------------------------
+ (set-language-environment "UTF-8")
+ (set-default-coding-systems 'utf-8)
+ (prefer-coding-system 'utf-8)
+ (set-terminal-coding-system 'utf-8)
+ (set-keyboard-coding-system 'utf-8)
+ (set-selection-coding-system 'utf-8)
+ (locale-coding-system 'utf-8)
+ (use-default-font-for-symbols nil)
;; Startup errors
(warning-minimum-level :emergency "Supress emacs warnings")
@@ -219,12 +335,11 @@ Emacs is self documenting, after all!
(browse-url-generic-program "qutebrowser" "set browser to librewolf")
(browse-url-secondary-browser-function 'browse-url-generic "set browser")
(browse-url-browser-function 'browse-url-generic "set browser")
- (default-frame-alist '((alpha-background . 80)
+ (default-frame-alist '((alpha-background . 100)
(vertical-scroll-bars)
(internal-border-width . 24)
(left-fringe . 8)
(right-fringe . 8)))
-
;; Mouse wheel
(mouse-wheel-scroll-amount '(1 ((shift) . 1)) "Nicer scrolling")
(mouse-wheel-progressive-speed nil "Make scrolling non laggy")
@@ -261,29 +376,38 @@ a variable an option. Often you will see a config section of a use-package decla
only one or two entries, which is intentional, as I've designed this configuration to put as
little in config as possible. I hardly consider most of this configuration to be imperative, but
of course Emacs was not designed to be fully imperative.
+** Network
+#+begin_src emacs-lisp :tangle ../nix/init.el
+(use-package enwc :custom (enwc-default-backend 'nm "use networkmanager backend"))
+#+end_src
+** System Monitor
+#+begin_src emacs-lisp :tangle ../nix/init.el
+(use-package proced
+ :custom (proced-enable-color-flag t "use colors in proced"))
+#+end_src
** Org Mode
This is my org mode configuration, which also configures latex.
#+begin_src emacs-lisp :tangle ../nix/init.el
- (use-package org
- :demand t
- :after (f s dash nix-mode)
- :hook
- ((org-mode . remove-annoying-pairing))
- :custom
- (org-export-allow-bind-keywords t "don't emit warnings")
- (org-confirm-babel-evaluate nil "I want to evaluate stuff when publishing")
- ;; Fix terrible indentation issues
- (org-edit-src-content-indentation 0)
- (org-src-tab-acts-natively t)
- (org-src-preserve-indentation t)
+(use-package org
+ :demand t
+ :after (f s dash nix-mode)
+ :hook
+ ((org-mode . remove-annoying-pairing))
+ :custom
+ (org-export-allow-bind-keywords t "don't emit warnings")
+ (org-confirm-babel-evaluate nil "I want to evaluate stuff when publishing")
+ ;; Fix terrible indentation issues
+ (org-edit-src-content-indentation 0)
+ (org-src-tab-acts-natively t)
+ (org-src-preserve-indentation t)
- (TeX-PDF-mode t)
- (org-confirm-babel-evaluate nil "Don't ask to evaluate code block")
- (org-export-with-broken-links t "publish website even with broken links")
- (org-src-fontify-natively t "Colors!")
+ (TeX-PDF-mode t)
+ (org-confirm-babel-evaluate nil "Don't ask to evaluate code block")
+ (org-export-with-broken-links t "publish website even with broken links")
+ (org-src-fontify-natively t "Colors!")
- ;; org-latex
- (org-format-latex-header "\\documentclass{article} \
+ ;; org-latex
+ (org-format-latex-header "\\documentclass{article} \
\\usepackage[usenames]{color} \
[DEFAULT-PACKAGES] \
[PACKAGES] \
@@ -303,187 +427,186 @@ This is my org mode configuration, which also configures latex.
\\addtolength{\\topmargin}{-2.54cm} \
\\usepackage{amsmath} \
")
- (org-preview-latex-image-directory (expand-file-name "~/.cache/ltximg/") "don't use weird cache location")
- (org-latex-preview-ltxpng-directory (expand-file-name "~/.cache/ltximg/") "don't use weird cache location")
- (org-latex-to-html-convert-command "printf '%%s' %i | pandoc -f latex -t html --mathml | tr -d '\\n' | sed -e 's/^<p>//' -e 's/<\\/p>$//'" "latex to MathML with special character handling")
- (org-latex-to-mathml-convert-command "printf '%%s' %i | pandoc -f latex -t html --mathml | tr -d '\\n' | sed -e 's/^<p>//' -e 's/<\\/p>$//'" "latex to MathML with special character handling")
-
- (TeX-engine 'xetex "set xelatex as default engine")
- (preview-default-option-list '("displaymath" "textmath" "graphics") "preview latex")
- ;; (preview-image-type 'png "Use PNGs")
- (org-preview-latex-default-process 'dvipng)
- (org-format-latex-options
- '(:foreground default
- :background default
- :scale 2
- :html-foreground "Black"
- :html-background "Transparent"
- :html-scale 1.5
- :matchers ("begin" "$1" "$" "$$" "\\(" "\\[")) "space latex better")
- (org-return-follows-link t "be able to follow links without mouse")
- (org-startup-indented t "Indent the headings")
- (org-image-actual-width '(300) "Cap width")
- (org-startup-with-latex-preview t "see latex previews on opening file")
- (org-startup-with-inline-images t "See images on opening file")
- (org-hide-emphasis-markers t "prettify org mode")
- (org-use-sub-superscripts "{}" "Only display superscripts and subscripts when enclosed in {}")
- (org-pretty-entities t "prettify org mode")
- (org-agenda-files (list "~/monorepo/agenda.org" "~/org/notes.org" "~/org/agenda.org") "set default org files")
- (org-default-notes-file (concat org-directory "/notes.org") "Notes file")
+ (org-preview-latex-image-directory (expand-file-name "~/.cache/ltximg/") "don't use weird cache location")
+ (org-latex-preview-ltxpng-directory (expand-file-name "~/.cache/ltximg/") "don't use weird cache location")
+ (org-latex-to-html-convert-command "printf '%%s' %i | pandoc -f latex -t html --mathml | tr -d '\\n' | sed -e 's/^<p>//' -e 's/<\\/p>$//'" "latex to MathML with special character handling")
+ (org-latex-to-mathml-convert-command "printf '%%s' %i | pandoc -f latex -t html --mathml | tr -d '\\n' | sed -e 's/^<p>//' -e 's/<\\/p>$//'" "latex to MathML with special character handling")
- ;; ricing
- (org-auto-align-tags nil)
- (org-tags-column 0)
- (org-catch-invisible-edits 'show-and-error)
- (org-special-ctrl-a/e t)
- (org-insert-heading-respect-content t)
- (org-hide-emphasis-markers t)
- (org-pretty-entities t)
- (org-agenda-tags-column 0)
- (org-ellipsis "…")
- :config
- (org-babel-do-load-languages 'org-babel-load-languages
- '((shell . t)
- (python . t)
- (nix . t)
- (scheme . t)
- (latex . t))))
+ (TeX-engine 'xetex "set xelatex as default engine")
+ (preview-default-option-list '("displaymath" "textmath" "graphics") "preview latex")
+ ;; (preview-image-type 'png "Use PNGs")
+ (org-preview-latex-default-process 'dvipng)
+ (org-format-latex-options
+ '(:foreground default
+ :background default
+ :scale 2
+ :html-foreground "Black"
+ :html-background "Transparent"
+ :html-scale 1.5
+ :matchers ("begin" "$1" "$" "$$" "\\(" "\\[")) "space latex better")
+ (org-return-follows-link t "be able to follow links without mouse")
+ (org-startup-indented t "Indent the headings")
+ (org-image-actual-width '(300) "Cap width")
+ (org-startup-with-latex-preview t "see latex previews on opening file")
+ (org-startup-with-inline-images t "See images on opening file")
+ (org-hide-emphasis-markers t "prettify org mode")
+ (org-use-sub-superscripts "{}" "Only display superscripts and subscripts when enclosed in {}")
+ (org-pretty-entities t "prettify org mode")
+ (org-agenda-files (list "~/monorepo/agenda.org" "~/org/notes.org" "~/org/agenda.org") "set default org files")
+ (org-default-notes-file (concat org-directory "/notes.org") "Notes file")
- (use-package org-tempo
- :after org)
+ ;; ricing
+ (org-auto-align-tags nil)
+ (org-tags-column 0)
+ (org-catch-invisible-edits 'show-and-error)
+ (org-special-ctrl-a/e t)
+ (org-insert-heading-respect-content t)
+ (org-hide-emphasis-markers t)
+ (org-pretty-entities t)
+ (org-agenda-tags-column 0)
+ (org-ellipsis "…")
+ :config
+ (org-babel-do-load-languages 'org-babel-load-languages
+ '((shell . t)
+ (python . t)
+ (nix . t)
+ (scheme . t)
+ (latex . t))))
- (use-package org-habit
- :after org
- :custom
- (org-habit-preceding-days 7 "See org habit entries")
- (org-habit-following-days 35 "See org habit entries")
- (org-habit-show-habits t "See org habit entries")
- (org-habit-show-habits-only-for-today nil "See org habit entries")
- (org-habit-show-all-today t "Show org habit graph"))
+(use-package org-tempo
+ :after org)
- (use-package htmlize
- :demand t
- :after (catppuccin-theme doom-themes yaml-mode))
+(use-package org-habit
+ :after org
+ :custom
+ (org-habit-preceding-days 7 "See org habit entries")
+ (org-habit-following-days 35 "See org habit entries")
+ (org-habit-show-habits t "See org habit entries")
+ (org-habit-show-habits-only-for-today nil "See org habit entries")
+ (org-habit-show-all-today t "Show org habit graph"))
- (unless noninteractive
- (use-package htmlize
- :after (doom-themes)))
+(use-package htmlize
+ :demand t
+ :after (catppuccin-theme doom-themes yaml-mode)
+ :config (advice-add 'face-attribute :around #'my-fix-htmlize-invalid-face-bug))
- (use-package ox-latex
- :after (org)
- :custom
- (org-latex-compiler "xelatex" "Use latex as default")
- (org-latex-pdf-process '("xelatex -interaction=nonstopmode -output-directory=%o %f") "set xelatex as default"))
+(use-package ox-latex
+ :after (org)
+ :custom
+ (org-latex-compiler "xelatex" "Use latex as default")
+ (org-latex-pdf-process '("xelatex -interaction=nonstopmode -output-directory=%o %f") "set xelatex as default"))
- (use-package ox-html
- :demand t
- :after (org htmlize)
- :custom
- (org-html-htmlize-output-type 'css "allow styling from CSS file")
- (org-html-with-latex 'html "let my html handler handle latex")
- (org-html-mathjax-options nil "disable mathjax, use MathML")
- (org-html-mathjax-template "" "disable mathjax, use MathML")
- (org-html-head-include-default-style nil "use my own css for everything")
- (org-html-head-include-scripts nil "use my own js for everything")
- (org-html-postamble (concat "Copyright © 2024 " system-fullname) "set copyright notice on bottom of site")
- (org-html-divs '((preamble "header" "preamble")
- (content "main" "content")
- (postamble "footer" "postamble")) "semantic html exports")
- (org-html-viewport '((width "device-width")
- (initial-scale "1.0")
- (minimum-scale "1.0")) "Prevent zooming out past default size")
- :config (advice-add 'org-html-latex-environment :around #'org-html-latex-environment-pandoc-fix))
+(use-package ox-html
+ :demand t
+ :after (org htmlize)
+ :custom
+ (org-html-htmlize-output-type 'css "allow styling from CSS file")
+ (org-html-with-latex 'html "let my html handler handle latex")
+ (org-html-mathjax-options nil "disable mathjax, use MathML")
+ (org-html-mathjax-template "" "disable mathjax, use MathML")
+ (org-html-head-include-default-style nil "use my own css for everything")
+ (org-html-head-include-scripts nil "use my own js for everything")
+ (org-html-postamble (concat "Copyright © 2024 " system-fullname) "set copyright notice on bottom of site")
+ (org-html-divs '((preamble "header" "preamble")
+ (content "main" "content")
+ (postamble "footer" "postamble")) "semantic html exports")
+ (org-html-viewport '((width "device-width")
+ (initial-scale "1.0")
+ (minimum-scale "1.0")) "Prevent zooming out past default size")
+ :config (advice-add 'org-html-latex-environment :around #'org-html-latex-environment-pandoc-fix))
- (use-package ox-rss
- :after org
- :demand t)
+(use-package ox-rss
+ :after org
+ :demand t)
- (use-package ox-publish
- :demand t
- :after (org f s dash ox-html ox-rss)
- :custom
- (org-publish-project-alist
- `(("website-org"
- :base-directory "~/monorepo"
- :base-extension "org"
- :exclude "nix/README\\.org\\|blog/rss\\.org\\|result/.*\\|nix/.*"
- :publishing-directory "~/website_html"
- :with-author t
- :with-date t
- :with-broken-links t
- :language en
+(use-package ox-publish
+ :demand t
+ :after (org f s dash ox-html ox-rss)
+ :custom
+ (org-publish-project-alist
+ `(("website-org"
+ :base-directory "~/monorepo"
+ :base-extension "org"
+ :exclude "nix/README\\.org\\|blog/rss\\.org\\|result/.*\\|nix/.*"
+ :publishing-directory "~/website_html"
+ :with-author t
+ :with-date t
+ :with-broken-links t
+ :language en
- :recursive t
- :publishing-function org-html-publish-to-html
- :headline-levels 4
- :html-footnotes-section "<div id=\"footnotes\"><hr><div id=\"text-footnotes\"><span class=\"footnotes-label-hidden\">%s</span>%s</div></div>"
- :html-head ,(concat "<meta name=\"theme-color\" content=\"#ffffff\">\n<link rel=\"preload\" href=\"/fonts/Inconsolata-Medium.woff2\" as=\"font\" type=\"font/woff2\" crossorigin>\n<meta name=\"theme-color\" content=\"#ffffff\">\n<link rel=\"preload\" href=\"/fonts/Lora-Medium.woff2\" as=\"font\" type=\"font/woff2\" crossorigin>\n<link rel=\"preload\" href=\"/fonts/CormorantGaramond-Bold.woff2\" as=\"font\" type=\"font/woff2\" crossorigin>\n<link rel=\"preload\" href=\"/fonts/CormorantGaramond-Medium.woff2\" as=\"font\" type=\"font/woff2\" crossorigin>\n<link rel=\"manifest\" href=\"/site.webmanifest\">\n<link rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/favicon-16x16.png\">\n<link rel=\"mask-icon\" href=\"/safari-pinned-tab.svg\" color=\"#5bbad5\">\n<link rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/favicon-32x32.png\">\n<link rel=\"apple-touch-icon\" sizes=\"180x180\" href=\"/apple-touch-icon.png\"><meta name=\"msapplication-TileColor\" content=\"#da532c\">\n"
- "<style>"
- (->> (create-htmlize-css)
- (s-replace-regexp "<style[^>]*>" "")
- (s-replace "</style>" "")
- (s-replace "<![CDATA[/*><![CDATA[/*>\n" "")
- (s-replace "/*]]>*/-->" "")
- (s-trim)
- (minify-css))
- (f-read-text "~/monorepo/style.css" 'utf-8)
- "</style>")
- :html-preamble t
- :html-preamble-format (("en" "<p class=\"preamble\"><a href=\"/index.html\">home</a> | <a href=\"./index.html\">section main page</a> | <a href=\"/blog/rss.xml\">rss feed</a></p><hr>"))
+ :recursive t
+ :publishing-function org-html-publish-to-html
+ :headline-levels 4
+ :html-footnotes-section "<div id=\"footnotes\"><hr><div id=\"text-footnotes\"><span class=\"footnotes-label-hidden\">%s</span>%s</div></div>"
+ :html-head ,(concat "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS Feed\" href=\"/blog/rss.xml\"><meta name=\"theme-color\" content=\"#ffffff\">\n<link rel=\"preload\" href=\"/fonts/Inconsolata-Medium.woff2\" as=\"font\" type=\"font/woff2\" crossorigin>\n<meta name=\"theme-color\" content=\"#ffffff\">\n<link rel=\"preload\" href=\"/fonts/Lora-Medium.woff2\" as=\"font\" type=\"font/woff2\" crossorigin>\n<link rel=\"preload\" href=\"/fonts/CormorantGaramond-Bold.woff2\" as=\"font\" type=\"font/woff2\" crossorigin>\n<link rel=\"preload\" href=\"/fonts/CormorantGaramond-Medium.woff2\" as=\"font\" type=\"font/woff2\" crossorigin>\n<link rel=\"manifest\" href=\"/site.webmanifest\">\n<link rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/favicon-16x16.png\">\n<link rel=\"mask-icon\" href=\"/safari-pinned-tab.svg\" color=\"#5bbad5\">\n<link rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/favicon-32x32.png\">\n<link rel=\"apple-touch-icon\" sizes=\"180x180\" href=\"/apple-touch-icon.png\"><meta name=\"msapplication-TileColor\" content=\"#da532c\">\n"
+ "<style>"
+ (or (ignore-errors
+ (->> (create-htmlize-css)
+ (s-replace-regexp "<style[^>]*>" "")
+ (s-replace "</style>" "")
+ (s-replace "<![CDATA[/*><![CDATA[/*>\n" "")
+ (s-replace "/*]]>*/-->" "")
+ (s-trim)
+ (minify-css)))
+ "/* HTMLIZE FAILED TO LOAD - CHECK EMACS INIT ERRORS */")
+ (f-read-text "~/monorepo/style.css" 'utf-8)
+ "</style>")
+ :html-preamble t
+ :html-preamble-format (("en" "<p class=\"preamble\"><a href=\"/index.html\">home</a> | <a href=\"./index.html\">section main page</a> | <a href=\"/blog/rss.xml\">rss feed</a></p><hr>"))
- ;; sitemap.html stuff
- :auto-sitemap t
- :sitemap-filename "sitemap.org"
- :sitemap-title "Site Index"
- :sitemap-style list
- :sitemap-sort-files anti-chronologically)
+ ;; sitemap.html stuff
+ :auto-sitemap t
+ :sitemap-filename "sitemap.org"
+ :sitemap-title "Site Index"
+ :sitemap-style list
+ :sitemap-sort-files anti-chronologically)
- ("website-blog-rss"
- :base-directory "~/monorepo/blog"
- :base-extension "org"
- :recursive nil
- :exclude "rss\\.org\\|index\\.org\\|404\\.org"
- :rss-extension "xml"
+ ("website-blog-rss"
+ :base-directory "~/monorepo/blog"
+ :base-extension "org"
+ :recursive nil
+ :exclude "rss\\.org\\|index\\.org\\|404\\.org"
+ :rss-extension "xml"
- :publishing-directory "~/website_html/blog"
- :publishing-function rp/org-rss-publish-to-rss
- :html-link-home "https://ret2pop.net/blog/"
- :html-link-use-abs-url t
+ :publishing-directory "~/website_html/blog"
+ :publishing-function rp/org-rss-publish-to-rss
+ :html-link-home "https://ret2pop.net/blog/"
+ :html-link-use-abs-url t
- ;; use custom sitemap functionality to publish rss feed
- :auto-sitemap t
- :sitemap-filename "rss.org"
- :sitemap-title "Blog Feed"
- :sitemap-style list
- :sitemap-sort-folders ignore
- :sitemap-sort-files anti-chronologically
- :sitemap-format-entry format-rss-feed-entry
- :sitemap-function format-rss-feed)
+ ;; use custom sitemap functionality to publish rss feed
+ :auto-sitemap t
+ :sitemap-filename "rss.org"
+ :sitemap-title "Blog Feed"
+ :sitemap-style list
+ :sitemap-sort-folders ignore
+ :sitemap-sort-files anti-chronologically
+ :sitemap-format-entry format-rss-feed-entry
+ :sitemap-function format-rss-feed)
- ("website-sitemap-xml"
- :base-directory "~/monorepo"
- :base-extension "org"
- :recursive t
- :exclude "nix/README\\.org\\|blog/rss\\.org"
- :publishing-directory "~/website_html"
- :publishing-function rp/org-sitemap-publish-function
- :auto-sitemap t
- :sitemap-filename "sitemap.xml"
- :sitemap-format-entry org-sitemap-format-entry-xml
- :sitemap-style list
- :sitemap-function org-sitemap-format-xml)
+ ("website-sitemap-xml"
+ :base-directory "~/monorepo"
+ :base-extension "org"
+ :recursive t
+ :exclude "nix/README\\.org\\|blog/rss\\.org"
+ :publishing-directory "~/website_html"
+ :publishing-function rp/org-sitemap-publish-function
+ :auto-sitemap t
+ :sitemap-filename "sitemap.xml"
+ :sitemap-format-entry org-sitemap-format-entry-xml
+ :sitemap-style list
+ :sitemap-function org-sitemap-format-xml)
- ("website-static"
- :base-directory "~/monorepo"
- :base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf\\|ico\\|asc\\|pub\\|webmanifest\\|xml\\|svg\\|txt\\|webp\\|conf"
- :publishing-directory "~/website_html/"
- :recursive t
- :publishing-function org-publish-attachment)
+ ("website-static"
+ :base-directory "~/monorepo"
+ :base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf\\|ico\\|asc\\|pub\\|webmanifest\\|xml\\|svg\\|txt\\|webp\\|conf"
+ :publishing-directory "~/website_html/"
+ :recursive t
+ :publishing-function org-publish-attachment)
- ("website"
- :auto-sitemap t
- :components ("website-org" "website-static" "website-blog-rss" "website-sitemap-xml")))
- "functions to publish website"))
+ ("website"
+ :auto-sitemap t
+ :components ("website-org" "website-static" "website-blog-rss" "website-sitemap-xml")))
+ "functions to publish website"))
#+end_src
As you can see, I only have one real entry in config here (I don't count requires even though
they have to be on the top)
@@ -712,6 +835,18 @@ Org superstar adds those nice looking utf-8 bullets:
:config
(global-org-modern-mode))
#+end_src
+** Notifications
+We use org-alert in order to give us notifications based on our org-agenda.
+#+begin_src emacs-lisp :tangle ../nix/init.el
+(use-package org-alert
+ :after (org ox-publish)
+ :custom
+ (alert-default-style 'libnotify)
+ (org-alert-interval 300)
+ (org-alert-notify-cutoff 10)
+ (org-alert-notify-after-event-cutoff 10)
+ :config (org-alert-enable))
+#+end_src
** LSP
We set up eglot, the LSP manager for emacs, now built in:
#+begin_src emacs-lisp :tangle ../nix/init.el
@@ -769,17 +904,39 @@ We want our emacs initialization to be pretty and display useful things.
(use-package dashboard
:after (projectile)
:custom
- (dashboard-banner-logo-title "Welcome, Commander!" "Set title for dashboard")
- (dashboard-icon-type 'nerd-icons "Use nerd icons")
- (dashboard-vertically-center-content t "Center content")
+ (dashboard-banner-logo-title "Introducing: Ret2pop" "Set title for dashboard")
+ (dashboard-startup-banner "/home/preston/monorepo/nix/data/logo.png")
+ (dashboard-icon-type 'all-the-icons "Use nerd icons")
+ (dashboard-center-content t "Center content")
(dashboard-set-init-info t)
+ (dashboard-set-heading-icons t)
+ (dashboard-set-file-icons t)
+
(dashboard-week-agenda t "Agenda in dashboard")
(dashboard-items '((recents . 5)
- (bookmarks . 5)
(projects . 5)
- (agenda . 5)
- (registers . 5)) "Look at some items")
- :config (unless noninteractive (dashboard-setup-startup-hook)))
+ (agenda . 5)) "Look at some items")
+ (dashboard-startupify-list '(dashboard-insert-banner
+ dashboard-insert-newline
+ dashboard-insert-banner-title
+ dashboard-insert-newline
+ dashboard-insert-navigator
+ dashboard-insert-newline
+ dashboard-insert-init-info
+ dashboard-insert-items
+ dashboard-insert-newline
+ dashboard-insert-footer))
+ :config
+ (unless noninteractive (dashboard-setup-startup-hook))
+
+ (my-fetch-weather-async)
+ (defvar my-weather-timer nil)
+ (when (timerp my-weather-timer)
+ (cancel-timer my-weather-timer))
+ (setq my-weather-timer (run-with-timer 900 900 #'my-fetch-weather-async))
+
+ (add-to-list 'dashboard-item-generators '(weather-clock . my-dashboard-insert-weather-clock))
+ (add-to-list 'dashboard-items '(weather-clock . 1)))
#+end_src
** Ivy
Ivy is a pretty cool general program for displaying stuff:
@@ -908,6 +1065,7 @@ emacs keybindings.
"o r s" '(elfeed :wk "rss feed")
"o a" '(org-agenda :wk "Open agenda")
"o w" '(eww :wk "web browser")
+ "o n" '(enwc :wk "NetworkManager Interface")
"m m" '(emms :wk "Music player")
"s m" '(proced :wk "System Manager")
"l p" '(list-processes :wk "List Emacs Processes")
@@ -1141,10 +1299,10 @@ elfeed to fetch feeds found on my website:
(use-package elfeed
:hook ((elfeed-search-mode . elfeed-update))
+ :general (:states 'normal :keymaps 'elfeed-search-mode-map "r" 'elfeed-update)
:custom
(elfeed-search-filter (format "@1-month-ago +unread !%s" (elfeed-final-filter elfeed-hn-filter-list)) "Only display unread articles from a month ago")
- (elfeed-curl-max-connections 8 "less max connections for less lag")
- :config (run-with-timer 0 (* 60 10) 'elfeed-update))
+ (elfeed-curl-max-connections 8 "less max connections for less lag"))
(use-package elfeed-org
:after (elfeed org)
@@ -1281,6 +1439,17 @@ Email in emacs can be done with Mu4e.
(use-package mu4e
:after smtpmail
+ :general
+ (:states '(normal motion) :keymaps 'mu4e-main-mode-map
+ "s" #'my-ivy-mu4e-search)
+
+ (:states '(normal motion) :keymaps 'mu4e-headers-mode-map
+ "s" #'my-ivy-mu4e-search
+ "/" #'my-mu4e-narrow-with-ivy)
+
+ (:states '(normal motion) :keymaps 'mu4e-thread-mode-map
+ "s" #'my-ivy-mu4e-search
+ "/" #'my-mu4e-narrow-with-ivy)
:hook
((mu4e-compose-mode . mml-secure-message-sign-pgpmime))
:custom
@@ -1297,6 +1466,7 @@ Email in emacs can be done with Mu4e.
(mu4e-compose-reply-ignore-address (list "no-?reply" system-email) "ignore my own address and noreply")
(mu4e-html2text-command "w3m -T text/html" "Use w3m to convert html to text")
(mu4e-update-interval 300 "Update duration")
+ (mu4e-completing-read-function 'ivy-completing-read)
(mu4e-headers-auto-update t "Auto-updates feed")
(mu4e-view-show-images t "Shows images")
(mu4e-compose-signature-auto-include nil)