aboutsummaryrefslogtreecommitdiff
path: root/emacs/.emacs.d/init/ycp-web.el
blob: bd6ca93613f0a3315b759983852e96c84a9e7558 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
;;; ycp-web.el -- My config for web related -*- lexical-binding: t -*-

;; Copyright (C) 2023 Free Software Foundation.

;; Author: Yuchen Pei <id@ypei.org>
;; Package-Requires: ((emacs "28.2"))

;; This file is part of dotfiles.

;; dotfiles is free software: you can redistribute it and/or modify it under
;; the terms of the GNU Affero General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.

;; dotfiles is distributed in the hope that it will be useful, but WITHOUT
;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General
;; Public License for more details.

;; You should have received a copy of the GNU Affero General Public
;; License along with dotfiles.  If not, see <https://www.gnu.org/licenses/>.

;;; Commentary:

;; My config for web related. Covers cookies, web browsing, clients to
;; web services like osm and openlibrary 

;;; Code:



;; disable cookies
(setq url-cookie-untrusted-urls ".*")
(ignore-errors (cancel-timer url-cookie-timer))

(setq shr-cookie-policy nil)

(my-package luwak
  (:delay 10)
  (:install t)
  (require 'luwak-org)
  (require 'my-utils)
  (setq luwak-url-rewrite-function 'my-rewrite-url)
  (setq luwak-tor-switch nil)
)

;;; openlibrary
(my-package my-openlibrary
  (:delay 15))

(my-package osm
  (:install t)
  (:delay 30)
  (require 'my-osm)
  (my-keybind osm-mode-map
    "C-<left>" nil
    "C-<right>" nil
    "C-<up>" nil
    "C-<down>" nil
    "c" #'my-osm-show-center)
  (require 'osm-ol)
  )

(my-package hnreader
  (:delay 30)
  (require 'my-hnreader)
  (my-override hnreader--print-frontpage)
  (my-override hnreader--print-frontpage-item)
  (my-override hnreader--print-comments)
  (my-override hnreader--get-title))

(add-to-list 'load-path (locate-user-emacs-file "lisp/lem.el/lisp"))
(my-package lem-org
  (:delay 30))

(my-package buildbot
  (:delay 30)
  (setq buildbot-default-host "https://buildbot.mariadb.org")
  (setq buildbot-api-changes-direct-filter t)
  )

(my-package org-jira
  (:delay 30)
  (my-setq-from-local jiralib-url
                      org-jira-priority-to-org-priority-alist
                      org-jira-jira-status-to-org-keyword-alist
                      org-jira-project-filename-alist
                      org-jira-custom-jqls)
  (require 'my-org-jira)
  (my-override org-jira--render-issue)
  (my-override org-jira-update-worklogs-from-org-clocks)
  (my-keybind org-jira-entry-mode-map "C-c ig" 'org-jira-get-issue)
  ;; `org-jira-mode' displays many whitespace-only lines in comments
  ;; it pulls.
  (add-hook 'org-jira-mode-hook
            (lambda () (setq show-trailing-whitespace nil)))
  )

(my-package eww
  (:delay 60)
  (advice-add 'eww-browse-url :filter-args #'my-rewrite-url-advice)
  (advice-add 'eww :filter-args #'my-rewrite-url-advice)
  (setq eww-restore-desktop t)
  (require 'my-utils)
  (setq eww-download-directory my-incoming-dir)
  (setq eww-bookmarks-directory (locate-user-emacs-file "eww-bookmarks"))
  (setq eww-history-limit 150)
  (setq eww-use-external-browser-for-content-type
        "\\`\\(video/\\|audio\\)") ; On GNU/Linux check your mimeapps.list
  (setq eww-browse-url-new-window-is-tab nil)
  (my-keybind eww-link-keymap "v" nil) ; stop overriding `eww-view-source'
  (my-keybind eww-mode-map "L" #'eww-list-bookmarks)
  (my-keybind eww-bookmark-mode-map "d" #'eww-bookmark-kill)
  )

(my-package my-web
  (:delay 60)
  (my-keybind eww-mode-map
    "N" #'my-eww-next-path
    "P" #'my-eww-prev-path
    "U" #'my-eww-up-path
    "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-override browse-url)
  )

(my-package my-semantic-scholar
  (:delay 60))

(my-package rt-liberation
  (:delay 60)
  (:install t)
  (my-setq-from-local rt-liber-username rt-liber-rest-url
                      rt-liber-base-url)
  (require 'my-rtliber)
  (my-override rt-liber-viewer-visit-in-browser)
)

(my-package rt-liberation-org
  (:delay 60))

(my-package rt-liberation-gnus
  (:delay 60)
  (my-setq-from-local rt-liber-gnus-address
                      rt-liber-gnus-comment-address
                      rt-liber-gnus-subject-name)
  (require 'my-rtliber)
  (my-keybind global-map
    "C-c t m" #'my-rt-liber-my-open-tickets
    "C-c t M" #'my-rt-liber-my-tickets
    "C-c t b" #'my-rt-liber-backlog
    "C-c t i" #'my-rt-liber-get-ticket-by-id
    "C-c t q" #'my-rt-liber-query-by-subject)
  )

;; sx: a stack exchange client
(my-package sx
  (:delay 60)
  (require 'sx-load))

;; mastodon
(add-to-list 'load-path (locate-user-emacs-file "lisp/mastodon.el/lisp"))
(my-package mastodon
  (my-setq-from-local mastodon-active-user mastodon-instance-url)
  ;; auto fill is a bit glitchy when composing a toot
  (add-hook 'mastodon-toot-mode-hook (lambda () (turn-off-auto-fill)))
  (mastodon))

(add-to-list 'load-path (locate-user-emacs-file "lisp/servall/lisp"))
(my-package servall-wikipedia
  (:delay 60)
  (require 'servall-ytdl)
  (my-setq-from-local servall-endpoint)
  (require 'my-servall)
  (my-keybind servall-wikipedia-view-mode-map "C-'" 'my-servall-wikipedia-grok)
)

(my-package my-libgen
  (:delay 60)
  (require 'my-utils)
  (my-setq-from-local my-libgen-hosts my-libgen-alt-hosts
                      my-libgen-library-hosts
                      )
  (setq my-libgen-download-dir my-document-incoming-dir)
  (my-libgen-set-random-hosts))

(my-package my-scihub
  (:delay 60)
  (my-setq-from-local my-scihub-host))

(provide 'ycp-web)