Emacs stuff

This commit is contained in:
2024-09-20 09:22:53 -07:00
parent 897490b10b
commit dab8e342aa

View File

@@ -16,6 +16,9 @@
(load-theme 'ef-eagle t)
(set-face-background 'default "#E8D8B0")
;; Lockfiles
(setq create-lockfiles nil)
;; Remove line numbers from specific modes
(dolist (mode '(org-mode-hook
term-mode-hook
@@ -53,6 +56,7 @@
(set-face-attribute 'org-scheduled-today nil :inherit 'variable-pitch :height 150)
(set-face-attribute 'org-drawer nil :inherit 'variable-pitch :height 150)
(set-face-attribute 'org-date nil :inherit 'variable-pitch :height 150)
;; Ensure that all agenda items use fixed-pitch font
(custom-set-faces
'(org-agenda-date-today ((t (:inherit fixed-pitch :weight bold))))
@@ -67,7 +71,6 @@
'(org-upcoming-deadline ((t (:inherit fixed-pitch))))
'(org-deadline-announce ((t (:inherit fixed-pitch))))
'(org-time-grid ((t (:inherit fixed-pitch)))))
)
(defun opal/org-mode-setup ()
@@ -75,7 +78,6 @@
(visual-line-mode 1)
(mixed-pitch-mode 1))
(use-package org
:commands (org-capture org-agenda)
:hook (org-mode . opal/org-mode-setup)
@@ -189,6 +191,21 @@
(add-to-list 'org-structure-template-alist '("sql" . "src sql"))
(add-to-list 'org-structure-template-alist '("py" . "src python")))
;; Programming
(setq geiser-guile-binary "/usr/bin/guile3.0")
;; Playing youtube videos via mpv/yt-dlp/emms
(defun opal/play-yt-url-at-point ()
"Play YT link under point with EMMS/MPV/yt-dlp."
(interactive)
(let ((url (thing-at-point 'url t)))
(if url
(emms-play-url url)
(message "No URL found at point."))))
(global-set-key (kbd "C-c y") 'opal/play-yt-url-at-point)
;; Elfeed
(defun opal/elfeed-open-in-firefox ()
"Open the current Elfeed entry link in Firefox."
(interactive)
@@ -231,23 +248,28 @@
"gr" 'elfeed-update ;; Refresh feeds
"q" 'quit-window)) ;; Quit Elfeed
(setq create-lockfiles nil)
(setq browse-url-browser-function 'eww-browse-url)
;; Make sure eww opens in it's own buffer
(after! eww
(set-popup-rule! "^\\*eww\\*" :ignore t))
;; Set eww webpage title in the modeline bar instead of just *eww*
(setq eww-auto-rename-buffer 'title)
;; eww
(defun opal/eww-reddit-redirect(url)
"Redirect reddit.com to custom URL automatically since Reddit blocks eww."
(replace-regexp-in-string "https://www.reddit.com" "https://safereddit.com" url))
"Redirect reddit.com to custom URL."
(replace-regexp-in-string "https://www.reddit.com" reddit-proxy url))
;; Redirect reddit links to privacy respecting frontends so Reddit doesn't reject the traffic from eww.
(setq eww-url-transformers '(eww-remove-tracking opal/eww-reddit-redirect))
(use-package eww
:config
(setq browse-url-browser-function 'eww-browse-url)
;; Set eww webpage title in the modeline bar instead of just *eww*
(setq eww-auto-rename-buffer 'title)
;; Set privacy respecting proxies
(setq reddit-proxy "https://eddrit.com")
;; Redirect reddit links to privacy respecting frontends.
(setq eww-url-transformers '(eww-remove-tracking opal/eww-reddit-redirect))
;; Make sure eww opens in it's own buffer
(after! eww
(set-popup-rule! "^\\*eww\\*" :ignore t)))
;; Since I sometimes write notes in two languages, guess-language will allow for multiple language
;; spelling checks to be done in a single buffer.
@@ -261,15 +283,3 @@
guess-language-min-paragraph-length 45)
:diminish guess-language-mode)
;; Temporary functions
(defun opal/remove-extra-asterisks-in-org ()
"Remove the second asterisk in **bold** text, converting it to *bold* in an Org file, without affecting spaces or headings."
(interactive)
(save-excursion
;; Start from the beginning of the buffer
(goto-char (point-min))
;; Loop through the buffer and replace **word** with *word* only if not in headings
(while (re-search-forward "\\([^*]\\)\\*\\*\\([^*\n]+\\)\\*\\*" nil t)
(replace-match "\\1*\\2*"))))
(setq geiser-guile-binary "/usr/bin/guile3.0")