From 04d97d3dacd14503e9f9736d735f7e8ba1e3308a Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Wed, 9 Jun 2021 21:48:11 -0500 Subject: Add browse-url functions I should break this out into a thingy. --- init.el | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) (limited to 'init.el') diff --git a/init.el b/init.el index 73a7c5d..48dd80c 100644 --- a/init.el +++ b/init.el @@ -89,12 +89,51 @@ browse-url-firefox-arguments '("--new-tab") ; for firefox browse-url-firefox-new-window-is-tab t) + (defvar browse-url-mpv-arguments nil + "Arguments to pass to mpv in `browse-url-mpv'.") + + (defun browse-url-mpv (url &optional new-window) + "Play `URL' in mpv." + (interactive (browse-url-interactive-arg "Video URL: ")) + (ignore new-window) ;; mpv always opens a new window + (let* ((url (browse-url-encode-url url)) + (process-environment (browse-url-process-environment))) + (message "Playing %s in mpv..." url) + (apply #'start-process + (concat "mpv " url) nil + "mpv" + (append + browse-url-mpv-arguments + (list url))))) + + (defvar browse-url-feh-arguments '("--auto-zoom" + "--geometry" "800x600") + "Arguments to pass to feh in `browse-url-feh'.") + + (defun browse-url-feh (url &optional new-window) + "Open `URL' in feh." + (interactive (browse-url-interactive-arg "Video URL: ")) + (ignore new-window) ;; mpv always opens a new window + (let* ((url (browse-url-encode-url url)) + (process-environment (browse-url-process-environment))) + (message "Opening %s in feh..." url) + (apply #'start-process + (concat "feh " url) nil + "feh" + (append + browse-url-feh-arguments + (list url))))) + ;; `browse-url-browser-function' as an alist is deprecated in Emacs 28 for ;; `browse-url-handlers'. (set-default (if (version<= emacs-version "28") 'browse-url-browser-function 'browse-url-handlers) - '(("." . eww-browse-url))) + `(,(when (executable-find "feh") + '("\\.jpe?g\\'" . browse-url-feh)) + ,(when (executable-find "mpv") + '("youtube\\.com\\|youtu\\.be" . browse-url-mpv)) + ("." . eww-browse-url))) ;; Buttonize gemini:// links. (acdw/add-button-url-regexp-protocol "gemini")) -- cgit 1.4.1-21-gabe81 From 7071871ce4617412cd2f648822ae6fcce9b94bf0 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Wed, 9 Jun 2021 21:48:31 -0500 Subject: Load erc module after erc --- init.el | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'init.el') diff --git a/init.el b/init.el index 48dd80c..77d7c62 100644 --- a/init.el +++ b/init.el @@ -336,12 +336,23 @@ erc-track-mode erc-truncate-mode) - ;; (setup (:straight erc-hl-nicks) - ;; (with-eval-after-load 'erc - ;; (require 'erc-hl-nicks) - ;; (:option erc-hl-nicks-minimum-contrast-ratio 4.5) - ;; (:hook-into erc-mode))) - ) + (with-eval-after-load 'erc + (setup (:straight erc-hl-nicks) + (:option (append erc-modules) 'hl-nicks + erc-hl-nicks-minimum-contrast-ratio 4.5 + erc-hl-nicks-color-contrast-strategy '(invert contrast)) + (:hook-into erc-mode) + ;; Refresh nick colors after changing modus theme + ;; Ideally, there'd be a hook for /any/ time we changed theme... but + ;; whatever. + (add-hook 'modus-themes-after-load-theme-hook + #'erc-hl-nicks-refresh-colors)) + + (setup (:straight erc-image) + (:option (append erc-modules) 'image + erc-image-inline-rescale 'window)) + + (erc-update-modules))) (setup eshell (:also-load acdw-eshell -- cgit 1.4.1-21-gabe81 From fa692177421dc79c607e2a0c5f6cef89f0f76a23 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Wed, 9 Jun 2021 21:48:42 -0500 Subject: Enable goto-address-mode --- init.el | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'init.el') diff --git a/init.el b/init.el index 77d7c62..712c7dc 100644 --- a/init.el +++ b/init.el @@ -452,6 +452,10 @@ like a dumbass." gnus-init-file (expand-file-name "gnus.el" user-emacs-directory)) (:global "C-c n" gnus)) +(setup goto-addr + (add-hook 'text-mode-hook #'goto-address-mode) + (add-hook 'prog-mode-hook #'goto-address-prog-mode)) + (setup ibuffer (:option ibuffer-saved-filter-groups '(("default" -- cgit 1.4.1-21-gabe81