aboutsummaryrefslogtreecommitdiff
path: root/emacs
diff options
context:
space:
mode:
authorYuchen Pei <id@ypei.org>2025-01-13 08:45:17 +1100
committerYuchen Pei <id@ypei.org>2025-01-13 08:45:17 +1100
commit54e253bd209960992417bc0005b7b0d6017fdcbb (patch)
tree84579d578a82ef69e91d3b11d4260f0fc9062e53 /emacs
parentf5a111de58af93660603c639043a514a4aeaa968 (diff)
[emacs] Move browse-url-handler element to each component
Diffstat (limited to 'emacs')
-rw-r--r--emacs/.emacs.d/init/ycp-markup.el6
-rw-r--r--emacs/.emacs.d/init/ycp-web.el78
2 files changed, 55 insertions, 29 deletions
diff --git a/emacs/.emacs.d/init/ycp-markup.el b/emacs/.emacs.d/init/ycp-markup.el
index f3d92d0..5f21da7 100644
--- a/emacs/.emacs.d/init/ycp-markup.el
+++ b/emacs/.emacs.d/init/ycp-markup.el
@@ -72,7 +72,11 @@
(my-keybind wiki-mode-map
"C-'" #'my-wiki-grok-wikipedia)
(my-setq-from-local wiki-sites)
- (wiki-define-site-commands))
+ (wiki-define-site-commands)
+ (add-to-list 'browse-url-handlers
+ `(wiki-engine-entry-url-p
+ . ,(lambda (url &rest _) (wiki-open-url url))))
+ )
(my-package ledger-mode
(:install t)
diff --git a/emacs/.emacs.d/init/ycp-web.el b/emacs/.emacs.d/init/ycp-web.el
index 7df2857..9b0bf0d 100644
--- a/emacs/.emacs.d/init/ycp-web.el
+++ b/emacs/.emacs.d/init/ycp-web.el
@@ -184,7 +184,12 @@
(my-override hnreader--print-frontpage)
(my-override hnreader--print-frontpage-item)
(my-override hnreader--print-comments)
- (my-override hnreader--get-title))
+ (my-override hnreader--get-title)
+ (require 'my-web)
+ (add-to-list 'browse-url-handlers
+ `(my-hacker-news-url-p
+ . ,(lambda (url &rest _) (hnreader-comment url))))
+ )
(add-to-list 'load-path (locate-user-emacs-file "lisp/lem.el/lisp"))
(my-package lem-org
@@ -216,6 +221,9 @@
'turn-off-auto-fill)
(add-hook 'org-jira-mode-hook
'turn-off-flyspell)
+ (add-to-list 'browse-url-handlers
+ `(my-org-jira-url-p
+ . ,(lambda (url &rest _) (my-org-jira-open-url url))))
)
(my-package dnd
@@ -250,32 +258,22 @@
"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
- `((exitter-post-url-p
- . ,(lambda (url &rest _) (exitter-open-post url)))
- (my-hacker-news-url-p
- . ,(lambda (url &rest _) (hnreader-comment url)))
- (my-gitlab-project-url-p
- . ,(lambda (url &rest _) (my-gitlab-project-infobox url)))
- (my-ytdl-video-url-p
- . ,(lambda (url &rest _) (my-ytdl-video-infobox url)))
- (my-mastodon-url-p
- . ,(lambda (url &rest _) (mastorg-open url)))
- (my-newscorp-au-url-p
- . ,(lambda (url &rest _) (my-open-newscorp-au url)))
- (my-org-jira-url-p
- . ,(lambda (url &rest _) (my-org-jira-open-url url)))
- (reddio-reddit-url-p
- . ,(lambda (url &rest _) (reddio-open-url url)))
- ("^https?://www.spectator.com.au\\>" .
- ,(lambda (url &rest args) (my-open-spectator-au url)))
- (my-stack-overflow-url-p
- . ,(lambda (url &rest _) (sx-open-link url)))
- (wiki-engine-entry-url-p
- . ,(lambda (url &rest _) (wiki-open-url url)))
- (stringp . browse-url-firefox)))
)
+(my-package my-gitlab
+ (:delay 60)
+ (add-to-list 'browse-url-handlers
+ `(my-gitlab-project-url-p
+ . ,(lambda (url &rest _) (my-gitlab-project-infobox url))))
+ )
+
+(my-package my-ytdl
+ (:delay 60)
+ (add-to-list 'browse-url-handlers
+ `(my-ytdl-video-url-p
+ . ,(lambda (url &rest _) (my-ytdl-video-infobox url)))))
+
+
(my-package my-semantic-scholar
(:delay 60))
@@ -308,7 +306,12 @@
;; sx: a stack exchange client
(my-package sx
(:delay 60)
- (require 'sx-load))
+ (require 'sx-load)
+ (require 'my-web)
+ (add-to-list 'browse-url-handlers
+ `(my-stack-overflow-url-p
+ . ,(lambda (url &rest _) (sx-open-link url))))
+ )
;; mastodon.el
(add-to-list 'load-path (locate-user-emacs-file "lisp/mastodon.el/lisp"))
@@ -319,7 +322,18 @@
(mastodon))
(my-package mastorg
- (:delay 60))
+ (:delay 60)
+ (require 'my-web)
+ (add-to-list 'browse-url-handlers
+ `(my-mastodon-url-p
+ . ,(lambda (url &rest _) (mastorg-open url))))
+ (add-to-list 'browse-url-handlers
+ `(my-newscorp-au-url-p
+ . ,(lambda (url &rest _) (my-open-newscorp-au url))))
+ (add-to-list 'browse-url-handlers
+ `("^https?://www.spectator.com.au\\>" .
+ ,(lambda (url &rest args) (my-open-spectator-au url))))
+ )
(add-to-list 'load-path (locate-user-emacs-file "lisp/servall/lisp"))
(my-package servall-wikipedia
@@ -364,9 +378,17 @@
exitter-access-token exitter-username exitter-password exitter-email
exitter-oauth-token exitter-oauth-token-secret exitter-oauth-token-ctime)
(setq exitter-debug nil)
+ (add-to-list 'browse-url-handlers
+ `(exitter-post-url-p
+ . ,(lambda (url &rest _) (exitter-open-post url))))
+
)
(my-package reddio
- (:delay 60))
+ (:delay 60)
+ (add-to-list 'browse-url-handlers
+ `(reddio-reddit-url-p
+ . ,(lambda (url &rest _) (reddio-open-url url))))
+ )
(provide 'ycp-web)