aboutsummaryrefslogtreecommitdiff
path: root/emacs
diff options
context:
space:
mode:
authorYuchen Pei <id@ypei.org>2024-12-26 22:44:51 +1100
committerYuchen Pei <id@ypei.org>2024-12-26 22:44:51 +1100
commitf6b8f3d09dd1228858d4c07973f4330d671abe2a (patch)
treef596dc05b69feeafaa3a79dde0c9eb4ff1dbd16a /emacs
parente79129bb75b2a63f82a99678d777872f124156df (diff)
[emacs] web related changes in emacs
open newscorp au update exitter submodule use reddio for reddit
Diffstat (limited to 'emacs')
-rw-r--r--emacs/.emacs.d/init/ycp-web.el18
m---------emacs/.emacs.d/lisp/exitter0
m---------emacs/.emacs.d/lisp/mastodon.el0
-rw-r--r--emacs/.emacs.d/lisp/my/my-web.el17
4 files changed, 28 insertions, 7 deletions
diff --git a/emacs/.emacs.d/init/ycp-web.el b/emacs/.emacs.d/init/ycp-web.el
index b156e9a..6b2c755 100644
--- a/emacs/.emacs.d/init/ycp-web.el
+++ b/emacs/.emacs.d/init/ycp-web.el
@@ -248,17 +248,22 @@
"T" #'my-eww-top-path
"b" #'my-eww-switch-by-title)
(my-keybind global-map "\C-c\C-o" #'my-browse-url-at-point)
+ (my-setq-from-local my-newscorp-au-amp-nk)
(setq browse-url-handlers
`(("^https?://www.spectator.com.au\\>" .
,(lambda (url &rest args) (my-open-spectator-au url)))
+ (my-newscorp-au-url-p
+ . ,(lambda (url &rest _) (my-open-newscorp-au url)))
(my-mastodon-url-p
- . ,(lambda (url &rest args) (mastorg-open url)))
+ . ,(lambda (url &rest _) (mastorg-open url)))
(my-hacker-news-url-p
- . ,(lambda (url &rest args) (hnreader-comment url)))
+ . ,(lambda (url &rest _) (hnreader-comment url)))
(reddio-reddit-url-p
- . ,(lambda (url &rest args) (reddio-open-url url)))
+ . ,(lambda (url &rest _) (reddio-open-url url)))
(my-stack-overflow-url-p
- . ,(lambda (url &rest args) (sx-open-link url)))
+ . ,(lambda (url &rest _) (sx-open-link url)))
+ (exitter-post-url-p
+ . ,(lambda (url &rest _) (exitter-open-post url)))
(stringp . browse-url-firefox)))
)
@@ -349,7 +354,10 @@
exitter-oauth-consumer-key exitter-oauth-consumer-secret
exitter-access-token exitter-username exitter-password exitter-email
exitter-oauth-token exitter-oauth-token-secret exitter-oauth-token-ctime)
- (setq exitter-debug t)
+ (setq exitter-debug nil)
)
+(my-package reddio
+ (:delay 60))
+
(provide 'ycp-web)
diff --git a/emacs/.emacs.d/lisp/exitter b/emacs/.emacs.d/lisp/exitter
-Subproject cdcda7feb9a5b9a4530be09149537217148b848
+Subproject c78c62bd4a0eca87ae711d1efbd3f0cca46faf7
diff --git a/emacs/.emacs.d/lisp/mastodon.el b/emacs/.emacs.d/lisp/mastodon.el
-Subproject d8ef4fff34862ff3cef76ea704b8c4c6c7d7508
+Subproject dbb1e5ef4473c418b164b4c74c44cf8ac95e4eb
diff --git a/emacs/.emacs.d/lisp/my/my-web.el b/emacs/.emacs.d/lisp/my/my-web.el
index 95592fd..f33f30c 100644
--- a/emacs/.emacs.d/lisp/my/my-web.el
+++ b/emacs/.emacs.d/lisp/my/my-web.el
@@ -180,6 +180,19 @@ e.g. https://news.ycombinator.com/item?id=42505454"
(and (equal "news.ycombinator.com" (url-host urlobj))
(string-match-p "^/item\\?id=[0-9]+$" (url-filename urlobj)))))
+(defvar my-newscorp-au-amp-nk nil)
+(defun my-open-newscorp-au (url)
+ (interactive "sNews Corp AU link: ")
+ (pcase-let* ((urlobj (url-generic-parse-url url))
+ (`(,path . _) (url-path-and-query urlobj)))
+ (setf (url-filename urlobj)
+ (format "%s?amp&nk=%s" path my-newscorp-au-amp-nk))
+ (browse-url-firefox (url-recreate-url urlobj))))
+
+(defun my-newscorp-au-url-p (url)
+ (string-match-p "^\\(www\\.\\)?\\(heraldsun\\|theaustralian\\)\\.com\\.au$"
+ (url-host (url-generic-parse-url url))))
+
(defun my-stack-overflow-url-p (url)
"Guess whether a url stack overflow question
e.g.
@@ -193,8 +206,8 @@ https://emacs.stackexchange.com/questions/40887/in-org-mode-how-do-i-link-to-int
;; (message "GOT %s" files)
(dolist (var files)
(let ((fname (expand-file-name (car var))))
- (when (string-match ".*/\\(https?:/\\)" fname)
- (browse-url (replace-match "\\1/" nil nil fname))
+ (when (string-match ".*/?\\(https?:\\)/+" fname)
+ (browse-url (replace-match "\\1//" nil nil fname))
(setq files (delq var files)))))
(apply orig-fun files client args))