From 4f72e23f72f9712999b8f629a4c62d6f78b65d3b Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Sat, 7 Aug 2021 15:05:16 -0500 Subject: Add twitter.com URL handling TODO: This could be smarter, e.g. not going to nitter if twitter.com/t.co is part of the URL query. --- init.el | 1 + lisp/acdw.el | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/init.el b/init.el index f31da5d..a4d8535 100644 --- a/init.el +++ b/init.el @@ -133,6 +133,7 @@ 'browse-url-mpv 'eww-browse-url)) ("google\\.com" . browse-url-default-browser) + ("\\(twitter\\.com\\|t\\.co\\)" . acdw/eww-browse-twitter-url) ("." . eww-browse-url))) ;; Buttonize gemini:// links. diff --git a/lisp/acdw.el b/lisp/acdw.el index 9d8c489..be12dd6 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el @@ -497,6 +497,15 @@ Then, build `browse-url-button-regexp' with the new protocol." (add-to-list 'acdw/button-protocols proto) (setq-default browse-url-button-regexp (acdw/build-button-url-regexp))) +;;; Browse-URL tweaks + +;; convert twitter.com to nitter +(defun acdw/eww-browse-twitter-url (url &rest args) + "Browse a Twitter.com URL using Nitter." + (let* ((nitter "nitter.snopyta.org") + (url (replace-regexp-in-string "twitter\\.com" nitter url))) + (eww-browse-url url args))) + ;;; Recentf renaming with dired ;; from ... somewhere. 'rjs', apparently? -- cgit 1.4.1-21-gabe81