summary refs log tree commit diff stats
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/acdw-chat.el96
-rw-r--r--lisp/acdw-mail.el87
-rw-r--r--lisp/acdw-org.el111
-rw-r--r--lisp/acdw-shell0
-rw-r--r--lisp/acdw-shell.el32
-rw-r--r--lisp/acdw-web.el30
-rw-r--r--lisp/acdw.el7
7 files changed, 269 insertions, 94 deletions
diff --git a/lisp/acdw-chat.el b/lisp/acdw-chat.el index 62dcf72..9294ffe 100644 --- a/lisp/acdw-chat.el +++ b/lisp/acdw-chat.el
@@ -51,6 +51,16 @@ CHANNEL, SERVER, NICK, and BIBOUMI-SERVER are passed to
51 nick 51 nick
52 'popup)))) 52 'popup))))
53 53
54(defalias 'jabber-irc-join 'jabber-biboumi-muc-connect)
55
56(defun jabber-connect-all* (&optional arg)
57 "Run `jabber-connect-all'.
58With a prefix ARG, disconnect first."
59 (interactive "p")
60 (when arg
61 (jabber-disconnect))
62 (jabber-connect-all))
63
54(defun jabber-group-yank-join-url () 64(defun jabber-group-yank-join-url ()
55 "Yank a url for joining the focused group." 65 "Yank a url for joining the focused group."
56 (interactive) 66 (interactive)
@@ -62,7 +72,7 @@ CHANNEL, SERVER, NICK, and BIBOUMI-SERVER are passed to
62;;; Packages 72;;; Packages
63 73
64(use-package jabber 74(use-package jabber
65 :load-path "~/src/emacs/jabber/" 75 :load-path "~/src/jabber.el/"
66 :custom-face 76 :custom-face
67 (jabber-activity-face ((t :inherit jabber-chat-prompt-foreign 77 (jabber-activity-face ((t :inherit jabber-chat-prompt-foreign
68 :foreground unspecified 78 :foreground unspecified
@@ -85,37 +95,58 @@ CHANNEL, SERVER, NICK, and BIBOUMI-SERVER are passed to
85 :bind-keymap ("C-c j" . jabber-global-keymap) 95 :bind-keymap ("C-c j" . jabber-global-keymap)
86 :bind (("C-c C-SPC" . jabber-activity-switch-to)) 96 :bind (("C-c C-SPC" . jabber-activity-switch-to))
87 :config 97 :config
88 (setopt jabber-account-list '(("acdw@hmm.st")) 98 (setq jabber-account-list '(("acdw@hmm.st"))
89 jabber-auto-reconnect t 99 jabber-auto-reconnect t
90 jabber-biboumi-server "irc.hmm.st" 100 jabber-biboumi-server "irc.hmm.st"
91 jabber-biboumi-irc-servers '("irc.libera.chat" 101 jabber-biboumi-irc-servers '("irc.libera.chat"
92 "irc.tilde.chat" 102 "irc.oftc.net"
93 "tilde.town" 103 "irc.tilde.chat"
94 "m455.casa" 104 "tilde.town"
95 "irc.twitch.tv") 105 "m455.casa"
96 jabber-biboumi-default-nick "acdw" 106 "irc.twitch.tv")
97 jabber-last-read-marker (make-string fill-column ?.) 107 jabber-biboumi-default-nick "acdw"
98 jabber-muc-decorate-presence-patterns 108 jabber-last-read-marker (make-string fill-column ?.)
99 '(("\\( enters the room ([^)]+)\\| has left the chatroom\\)$" . nil) 109 jabber-muc-decorate-presence-patterns
100 ("Mode #.*" . jabber-muc-presence-dim) 110 '(("\\( enters the room ([^)]+)\\| has left the chatroom\\)$" . nil)
101 ("." . jabber-muc-presence-dim)) 111 ("Mode #.*" . jabber-muc-presence-dim)
102 jabber-activity-make-strings #'jabber-activity-make-strings-shorten 112 ("." . jabber-muc-presence-dim))
103 jabber-rare-time-format " - - - - - - %H:%M %F" 113 jabber-activity-make-strings #'jabber-activity-make-strings-shorten
104 jabber-muc-header-line-format 114 jabber-rare-time-format " - - - - - - %H:%M %F"
105 '(" " (:eval (replace-regexp-in-string "%" "%%" 115 jabber-chat-header-line-format
106 (jabber-jid-displayname 116 '("" (jabber-chat-buffer-show-avatar
107 jabber-group))) 117 (:eval
108 " / " jabber-muc-topic) 118 (let ((buddy (jabber-jid-symbol jabber-chatting-with)))
109 ;; buffer name formats 119 (jabber-propertize " "
110 jabber-chat-buffer-format "*xmpp* %n" 120 'display (get buddy 'avatar)))))
111 jabber-browse-buffer-format "*xmpp-browse* %n" 121 (:eval (replace-regexp-in-string "%" "%%"
112 jabber-groupchat-buffer-format "*xmpp-muc* %n" 122 (jabber-jid-displayname
113 jabber-muc-private-buffer-format "*xmpp-muc-private* %n" 123 jabber-chatting-with)))
114 ;; "prompt" (speaker) formats 124 "\t" (:eval (let ((buddy (jabber-jid-symbol jabber-chatting-with)))
115 jabber-groupchat-prompt-format (format "%%>%dn . " jabber-prefix-width) 125 (propertize
116 jabber-chat-local-prompt-format (format "%%>%dn . " jabber-prefix-width) 126 (or
117 jabber-chat-foreign-prompt-format (format "%%>%dn . " jabber-prefix-width) 127 (cdr (assoc (get buddy 'show) jabber-presence-strings))
118 jabber-muc-private-foreign-prompt-format "\n%g/%n . ") 128 (get buddy 'show))
129 'face
130 (or (cdr (assoc (get buddy 'show) jabber-presence-faces))
131 'jabber-roster-user-online))))
132 "\t" (:eval (jabber-fix-status (get (jabber-jid-symbol jabber-chatting-with) 'status)))
133 "\t" jabber-events-message
134 "\t" jabber-chatstates-message)
135 jabber-muc-header-line-format
136 '(" " (:eval (replace-regexp-in-string "%" "%%"
137 (jabber-jid-displayname
138 jabber-group)))
139 " / " jabber-muc-topic)
140 ;; buffer name formats
141 jabber-chat-buffer-format "*xmpp* %n"
142 jabber-browse-buffer-format "*xmpp-browse* %n"
143 jabber-groupchat-buffer-format "*xmpp-muc* %n"
144 jabber-muc-private-buffer-format "*xmpp-muc-private* %n"
145 ;; "prompt" (speaker) formats
146 jabber-groupchat-prompt-format (format "%%>%dn . " jabber-prefix-width)
147 jabber-chat-local-prompt-format (format "%%>%dn . " jabber-prefix-width)
148 jabber-chat-foreign-prompt-format (format "%%>%dn . " jabber-prefix-width)
149 jabber-muc-private-foreign-prompt-format "\n%g/%n . ")
119 ;; jabber muc nick coloring 150 ;; jabber muc nick coloring
120 ;; wgreenhous | I found 1.5 ok for saturation and 2.0 for value (modus) 151 ;; wgreenhous | I found 1.5 ok for saturation and 2.0 for value (modus)
121 ;; (setopt jabber-muc-nick-value 1.0 152 ;; (setopt jabber-muc-nick-value 1.0
@@ -131,6 +162,7 @@ CHANNEL, SERVER, NICK, and BIBOUMI-SERVER are passed to
131 (map-keymap (lambda (key command) 162 (map-keymap (lambda (key command)
132 (define-key jabber-global-keymap (vector (+ key #x60)) command)) 163 (define-key jabber-global-keymap (vector (+ key #x60)) command))
133 jabber-global-keymap) 164 jabber-global-keymap)
165 (define-key jabber-global-keymap "c" #'jabber-connect-all*)
134 (require 'jabber-httpupload nil t) 166 (require 'jabber-httpupload nil t)
135 (add-hook 'jabber-post-connect-hooks #'jabber-enable-carbons) 167 (add-hook 'jabber-post-connect-hooks #'jabber-enable-carbons)
136 (remove-hook 'jabber-alert-muc-hooks 'jabber-muc-echo) 168 (remove-hook 'jabber-alert-muc-hooks 'jabber-muc-echo)
diff --git a/lisp/acdw-mail.el b/lisp/acdw-mail.el index f8111e7..bf20c9b 100644 --- a/lisp/acdw-mail.el +++ b/lisp/acdw-mail.el
@@ -146,7 +146,7 @@ the saved search as well."
146 (notmuch-poll))) 146 (notmuch-poll)))
147 (lambda (_) 147 (lambda (_)
148 (message "Polling mail (async)...done")))) 148 (message "Polling mail (async)...done"))))
149 ;;(user-error "Feature `async' not found!") 149 (user-error "Feature `async' not found!")
150 (notmuch-poll))) 150 (notmuch-poll)))
151 151
152;;; https://kitchingroup.cheme.cmu.edu/blog/2015/09/04/Checking-for-email-attachments-before-you-send-email/ 152;;; https://kitchingroup.cheme.cmu.edu/blog/2015/09/04/Checking-for-email-attachments-before-you-send-email/
@@ -172,28 +172,93 @@ the saved search as well."
172 (error "No attachment. Aborting send.")))) 172 (error "No attachment. Aborting send."))))
173 173
174;;; Process ical attachments 174;;; Process ical attachments
175;; https://www.reddit.com/r/emacs/comments/8s1ion/comment/e0x5kgd/
176
177(defun ical2org (&optional replace output-buffer)
178 "Run ical2org on contents of this buffer.
179If REPLACE (interactive prefix argument), replace contents of the
180buffer. If no REPLACE nor OUTPUT-BUFFER, output goes to
181minibuffer."
182 (interactive "P")
183 (shell-command-on-region (point-min) (point-max)
184 "ical2org.awk"
185 output-buffer
186 replace
187 "*ical2org errors*"
188 'display-errors))
189
190(defun ical2org-capture ()
191 "Run `ical2org' on this buffer, then `org-capture' the result.
192Leaves current buffer as-was afterwards."
193 (interactive)
194 (let ((buf (current-buffer))
195 (ics (buffer-string)))
196 (ical2org 'replace buf)
197 (mark-whole-buffer)
198 (org-capture nil "a")
199 (mark-whole-buffer)
200 (delete-region (point-min) (point-max))
201 (insert ics)))
202
203(defun notmuch-ics-refile (filename header)
204 "Refile the current ICS buffer to FILENAME, under HEADER."
205 (org-refile nil nil
206 (list header
207 filename
208 nil
209 (with-current-buffer (find-file-noselect filename)
210 (org-find-exact-headline-in-buffer header))))
211 (notmuch-ics-kill))
212
213(defun notmuch-ics-kill ()
214 "Kill the current ICS buffer and delete its file."
215 (let ((kill-buffer-hook nil)
216 (kill-buffer-query-functions nil)
217 (file (buffer-file-name)))
218 (set-buffer-modified-p nil)
219 (kill-buffer-and-window)
220 (delete-file file)))
221
222(defun notmuch-ics-cancel ()
223 "Cancel saving ICS buffer."
224 (interactive)
225 (notmuch-ics-kill))
226
227(define-derived-mode notmuch-save-ics-mode org-mode
228 "Org-mode but with a different keymap.")
175 229
176(defun notmuch-save-ics () 230(defun notmuch-save-ics ()
231 ;; XXX: this is hacky as hell
177 "Save a .ics file in a message." 232 "Save a .ics file in a message."
178 (interactive) 233 (interactive)
179 (with-current-notmuch-show-message 234 (with-current-notmuch-show-message
180 (notmuch-foreach-mime-part 235 (notmuch-foreach-mime-part
181 (lambda (part) 236 (lambda (part)
182 (message "%S" part)
183 (when (and (listp part) 237 (when (and (listp part)
184 (or (equal "application/ics" (caadr part)) 238 (or (equal "application/ics" (caadr part))
185 ;; (equal "text/calendar" (caadr part)) 239 ;; (equal "text/calendar" (caadr part))
186 )) 240 ))
187 (save-window-excursion 241 (let* ((filename (format "/dev/shm/notmuch-%s.ics"
188 (let* ((filename "/tmp/notmuch.ics") 242 (time-convert (current-time) 'integer))))
189 (buf (find-file-noselect filename))) 243 (mm-save-part-to-file part filename)
190 (delete-file filename) 244 (message "Converting ICS to org ...")
191 (kill-buffer (get-file-buffer filename)) 245 (with-current-buffer (find-file-other-window filename)
192 (mm-save-part-to-file part filename) 246 (ical2org 'replace (current-buffer))
193 (icalendar-import-file filename diary-file) 247 (deactivate-mark)
194 (kill-buffer buf))))) 248 (let ((org-mode-hook nil))
249 (notmuch-save-ics-mode))
250 (local-set-key (kbd "C-c C-c")
251 (lambda () (interactive)
252 (notmuch-ics-refile (sync/ "org/diary.org") "Appointments")))
253 (local-set-key (kbd "C-c C-k") #'notmuch-ics-cancel)
254 (setq-local header-line-format
255 (concat "ICAL buffer. "
256 "Finish: `C-c C-c'. "
257 "Abort: `C-c C-k'."))))))
195 (mm-dissect-buffer t t)))) 258 (mm-dissect-buffer t t))))
196 259
260(add-hook 'notmuch-show-hook #'notmuch-save-ics)
261
197 262
198;;; Fixes 263;;; Fixes
199 264
@@ -338,7 +403,7 @@ the saved search as well."
338 (add-hook 'notmuch-show-mode-hook #'visual-fill-column-mode) 403 (add-hook 'notmuch-show-mode-hook #'visual-fill-column-mode)
339 404
340 (define-advice notmuch-bury-or-kill-this-buffer (:after (&rest _) poll-async) 405 (define-advice notmuch-bury-or-kill-this-buffer (:after (&rest _) poll-async)
341 (notmuch-async-poll)) 406 (call-process "swaymail"))
342 407
343 (define-advice notmuch-address-selection-function 408 (define-advice notmuch-address-selection-function
344 (:override (prompt collection _) no-initial-input) 409 (:override (prompt collection _) no-initial-input)
diff --git a/lisp/acdw-org.el b/lisp/acdw-org.el index f961dda..2ec3339 100644 --- a/lisp/acdw-org.el +++ b/lisp/acdw-org.el
@@ -137,19 +137,33 @@ itself. Other values of ARG will call `newline' with that ARG."
137 137
138 138
139;;; Copy rich text to the keyboard 139;;; Copy rich text to the keyboard
140
140;; Thanks to Oleh Krehel: 141;; Thanks to Oleh Krehel:
141;; https://emacs.stackexchange.com/questions/54292/copy-results-of-org-export-directly-to-clipboard 142;; https://emacs.stackexchange.com/questions/54292/copy-results-of-org-export-directly-to-clipboard
142;; So. Emacs can't do this itself because it doesn't support sending clipboard 143;; So. Emacs can't do this itself because it doesn't support sending clipboard
143;; or selection contents as text/html. We have to use xclip instead. 144;; or selection contents as text/html. We have to use xclip instead.
145;; (defun org-to-html-to-clipboard (&rest org-export-args)
146;; "Export current org buffer to HTML, then copy it to the clipboard.
147;; ORG-EXPORT-ARGS are passed to `org-export-to-file'."
148;; (let ((f (make-temp-file "org-html-export")))
149;; (apply #'org-export-to-file 'html f org-export-args)
150;; (start-process "xclip" " *xclip*"
151;; "xclip" "-verbose" "-i" f
152;; "-t" "text/html" "-selection" "clipboard")
153;; (message "HTML pasted to clipboard.")))
154
155;; Wayland version.. TODO: make it work for both
144(defun org-to-html-to-clipboard (&rest org-export-args) 156(defun org-to-html-to-clipboard (&rest org-export-args)
145 "Export current org buffer to HTML, then copy it to the clipboard. 157 "Export current org buffer to HTML, then copy it to the clipboard.
146ORG-EXPORT-ARGS are passed to `org-export-to-file'." 158ORG-EXPORT-ARGS are passed to `org-export-to-file'."
147 (let ((f (make-temp-file "org-html-export"))) 159 (let ((buf (generate-new-buffer "*org-html-clipboard*" t)))
148 (apply #'org-export-to-file 'html f org-export-args) 160 (apply #'org-export-to-buffer 'html buf org-export-args)
149 (start-process "xclip" " *xclip*" 161 (with-current-buffer buf
150 "xclip" "-verbose" "-i" f 162 (call-process-region (point-min) (point-max)
151 "-t" "text/html" "-selection" "clipboard") 163 "wl-copy" nil nil nil
152 (message "HTML pasted to clipboard."))) 164 "-t" "text/html")
165 (kill-buffer-and-window))
166 (message "HTML copied to clipboard.")))
153 167
154(defun org-subtree-to-html-to-clipboard () 168(defun org-subtree-to-html-to-clipboard ()
155 "Export current subtree to HTML." 169 "Export current subtree to HTML."
@@ -203,6 +217,33 @@ If LIST is non-nil, return the result as a list instead of a string."
203 (when (org-at-heading-p) (org-align-tags)))))) 217 (when (org-at-heading-p) (org-align-tags))))))
204 218
205 219
220;;; Navigating headings
221
222(defun org-next-visible-heading-unfolding (arg)
223 (interactive "p")
224 (when (let ((pt (org-next-visible-heading arg)))
225 (and (buffer-narrowed-p)
226 (or (= (point) (point-min))
227 (and pt
228 (= pt (point-max))))))
229 (widen)
230 (org-next-visible-heading arg)
231 (org-narrow-to-subtree)))
232
233(defun org-previous-visible-heading-unfolding (arg)
234 (interactive "p")
235 (org-next-visible-heading-unfolding (- arg)))
236
237(defun org-up-heading-unfolding (arg)
238 (interactive "p")
239 (when (let ((pt (outline-up-heading arg)))
240 (and (buffer-narrowed-p)
241 (= (point) (point-min))))
242 (widen)
243 (org-up-heading-unfolding arg)
244 (org-narrow-to-subtree)))
245
246
206;;; Misc. 247;;; Misc.
207 248
208(defun org-clock-in-or-out (prefix) 249(defun org-clock-in-or-out (prefix)
@@ -261,19 +302,20 @@ If LIST is non-nil, return the result as a list instead of a string."
261 org-archive-mark-done t 302 org-archive-mark-done t
262 org-fold-catch-invisible-edits 'show-and-error 303 org-fold-catch-invisible-edits 'show-and-error
263 org-clock-clocked-in-display 'mode-line 304 org-clock-clocked-in-display 'mode-line
264 org-clock-string-limit 7 ; just the clock bit 305 org-clock-string-limit 0
265 org-clock-persist nil 306 org-clock-persist nil
266 org-confirm-babel-evaluate nil 307 org-confirm-babel-evaluate nil
267 org-cycle-separator-lines 0 308 org-cycle-separator-lines 0
268 org-deadline-warning-days 0 309 org-deadline-warning-days 0
269 org-directory (sync/ "org/" t) 310 org-directory (sync/ "org/" t)
270 org-ellipsis (or (bound-and-true-p truncate-string-ellipsis) "…") 311 org-ellipsis (or (bound-and-true-p truncate-string-ellipsis) "…")
271 org-emphasis-alist '(("*" org-bold) 312 org-emphasis-alist
272 ("/" org-italic) 313 '(("*" org-bold)
273 ("_" org-underline) 314 ("/" org-italic)
274 ("=" org-verbatim) 315 ("_" org-underline)
275 ("~" org-code) 316 ("=" org-verbatim)
276 ("+" org-strikethrough)) 317 ("~" org-code)
318 ("+" org-strikethrough))
277 org-fontify-done-headline t 319 org-fontify-done-headline t
278 org-fontify-quote-and-verse-blocks t 320 org-fontify-quote-and-verse-blocks t
279 org-fontify-whole-heading-line t 321 org-fontify-whole-heading-line t
@@ -320,6 +362,9 @@ If LIST is non-nil, return the result as a list instead of a string."
320 (keymap-set org-mode-map "S-<return>" #'+org-table-copy-down|+org-return-dwim) 362 (keymap-set org-mode-map "S-<return>" #'+org-table-copy-down|+org-return-dwim)
321 (keymap-unset org-mode-map "C-'" t) 363 (keymap-unset org-mode-map "C-'" t)
322 (keymap-unset org-mode-map "C-," t) 364 (keymap-unset org-mode-map "C-," t)
365 (keymap-set org-mode-map "C-c C-n" #'org-next-visible-heading-unfolding)
366 (keymap-set org-mode-map "C-c C-p" #'org-previous-visible-heading-unfolding)
367 (keymap-set org-mode-map "C-c C-u" #'org-up-heading-unfolding)
323 ;; Hooks 368 ;; Hooks
324 (add-hook 'org-mode-hook 369 (add-hook 'org-mode-hook
325 (defun org-mode@setup () 370 (defun org-mode@setup ()
@@ -333,7 +378,8 @@ If LIST is non-nil, return the result as a list instead of a string."
333 (add-hook 'before-save-hook 378 (add-hook 'before-save-hook
334 (defun before-save@org-mode@before-save () 379 (defun before-save@org-mode@before-save ()
335 (org-align-tags 'all) 380 (org-align-tags 'all)
336 (+org-hide-drawers-except-point)) 381 (+org-hide-drawers-except-point)
382 )
337 nil :local))) 383 nil :local)))
338 ;; Extra font-lock keywords 384 ;; Extra font-lock keywords
339 (font-lock-add-keywords 385 (font-lock-add-keywords
@@ -353,13 +399,15 @@ If LIST is non-nil, return the result as a list instead of a string."
353 ("<f8>" . org-clock-in-or-out)) 399 ("<f8>" . org-clock-in-or-out))
354 :config 400 :config
355 (setopt org-clock-clocked-in-display 'mode-line 401 (setopt org-clock-clocked-in-display 'mode-line
356 global-mode-string 402 ;; global-mode-string
357 '((t jabber-activity-mode-string) 403 ;; '((t jabber-activity-mode-string)
358 (:eval (when (org-clocking-p) org-mode-line-string)) 404 ;; (:eval (when (org-clocking-p) org-mode-line-string))
359 (display-time-mode display-time-string))) 405 ;; (display-time-mode display-time-string))
360 (add-hook 'org-clock-in-hook (defun org-clock@remove-from-global-mode-string () 406 )
361 (setq global-mode-string 407 ;; (add-hook 'org-clock-in-hook (defun org-clock@remove-from-global-mode-string ()
362 (delq 'org-mode-line-string global-mode-string))))) 408 ;; (setq global-mode-string
409 ;; (delq 'org-mode-line-string global-mode-string))))
410 )
363 411
364(use-package org-agenda 412(use-package org-agenda
365 :bind (("C-c a" . org-agenda)) 413 :bind (("C-c a" . org-agenda))
@@ -372,7 +420,7 @@ If LIST is non-nil, return the result as a list instead of a string."
372 (800 1000 1200 1400 1600 1800 2000) 420 (800 1000 1200 1400 1600 1800 2000)
373 " ┄┄┄┄┄ " "┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄") 421 " ┄┄┄┄┄ " "┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄")
374 org-agenda-current-time-string "← now ───────────────" 422 org-agenda-current-time-string "← now ───────────────"
375 org-agenda-include-diary t ; I use the org-diary features 423 org-agenda-include-diary nil ; I use the org-diary features
376 org-agenda-todo-ignore-deadlines 'near 424 org-agenda-todo-ignore-deadlines 'near
377 org-agenda-todo-ignore-scheduled 'future 425 org-agenda-todo-ignore-scheduled 'future
378 org-agenda-include-deadlines t 426 org-agenda-include-deadlines t
@@ -397,7 +445,8 @@ If LIST is non-nil, return the result as a list instead of a string."
397 '("WAIT" "MCKENZIE" "RACHEL"))))) 445 '("WAIT" "MCKENZIE" "RACHEL")))))
398 (stuck "" ((org-agenda-overriding-header "Waiting")))) 446 (stuck "" ((org-agenda-overriding-header "Waiting"))))
399 ((org-agenda-files ',(list (progn (require 'chd) 447 ((org-agenda-files ',(list (progn (require 'chd)
400 (chd/ "inbox-chd.org")))))))) 448 (chd/ "inbox-chd.org"))
449 (sync/ "org/diary.org")))))))
401 ;; Speedup agenda generation 450 ;; Speedup agenda generation
402 ;; https://orgmode.org/manual/Speeding-Up-Your-Agendas.html 451 ;; https://orgmode.org/manual/Speeding-Up-Your-Agendas.html
403 ;; https://orgmode.org/worg/agenda-optimization.html 452 ;; https://orgmode.org/worg/agenda-optimization.html
@@ -409,7 +458,7 @@ If LIST is non-nil, return the result as a list instead of a string."
409 (add-hook 'org-agenda-mode-hook #'truncate-lines-local-mode) 458 (add-hook 'org-agenda-mode-hook #'truncate-lines-local-mode)
410 (add-hook 'org-agenda-mode-hook #'hl-line-mode) 459 (add-hook 'org-agenda-mode-hook #'hl-line-mode)
411 (add-hook 'org-agenda-after-show-hook #'org-narrow-to-subtree) 460 (add-hook 'org-agenda-after-show-hook #'org-narrow-to-subtree)
412 (add-hook 'org-agenda-after-show-hook #'+org-hide-drawers-except-point) 461 ;; (add-hook 'org-agenda-after-show-hook #'+org-hide-drawers-except-point)
413 (define-advice org-agenda-files (:filter-return (files) skip-regexp) 462 (define-advice org-agenda-files (:filter-return (files) skip-regexp)
414 "Filter some files from `org-agenda'." 463 "Filter some files from `org-agenda'."
415 (when org-agenda-skip-file-regexp 464 (when org-agenda-skip-file-regexp
@@ -420,11 +469,17 @@ If LIST is non-nil, return the result as a list instead of a string."
420 files))) 469 files)))
421 files) 470 files)
422 (define-advice org-agenda (:around (orig &rest r) inhibit-hooks) 471 (define-advice org-agenda (:around (orig &rest r) inhibit-hooks)
423 (let ((org-mode-hook nil)) 472 (dlet ((org-mode-hook nil))
473 (apply orig r)))
474 (define-advice org-agenda-skip (:around (orig &rest r) fix-looking-at)
475 (dlet ((comment-start-skip "^\\s-*#\\(?: \\|$\\)"))
424 (apply orig r))) 476 (apply orig r)))
477 ;; (advice-remove 'org-agenda 'org-agenda@inhibit-hooks)
425 (define-advice org-agenda-switch-to (:after (&rest _) do-hooks) 478 (define-advice org-agenda-switch-to (:after (&rest _) do-hooks)
426 (run-hooks 'org-mode-hook)) 479 (run-hooks 'org-mode-hook))
427 (progress@around org-agenda-list "Building agenda")) 480 (progress@around org-agenda-list "Building agenda")
481 (with-eval-after-load 'org-agenda
482 (add-to-list 'org-agenda-files (sync/ "org/diary.org"))))
428 483
429(use-package org-capture 484(use-package org-capture
430 :bind (("C-c c" . org-capture))) 485 :bind (("C-c c" . org-capture)))
@@ -465,7 +520,7 @@ effect for exporting link types)."
465 org-export-with-toc nil)) 520 org-export-with-toc nil))
466 521
467(use-package org-word-count 522(use-package org-word-count
468 :load-path "~/src/emacs/org-word-count/" 523 :load-path "~/src/org-word-count.el/"
469 :hook org-mode-hook) 524 :hook org-mode-hook)
470 525
471(use-package org-modern 526(use-package org-modern
@@ -487,7 +542,7 @@ effect for exporting link types)."
487 542
488(use-package org-taskwise 543(use-package org-taskwise
489 :after org 544 :after org
490 :load-path "~/src/emacs/org-taskwise/") 545 :load-path "~/src/org-taskwise.el/")
491 546
492(provide 'acdw-org) 547(provide 'acdw-org)
493;;; acdw-org.el ends here 548;;; acdw-org.el ends here
diff --git a/lisp/acdw-shell b/lisp/acdw-shell deleted file mode 100644 index e69de29..0000000 --- a/lisp/acdw-shell +++ /dev/null
diff --git a/lisp/acdw-shell.el b/lisp/acdw-shell.el index 7c542aa..ce63bdc 100644 --- a/lisp/acdw-shell.el +++ b/lisp/acdw-shell.el
@@ -52,8 +52,8 @@
52 (concat (if (= 0 eshell-last-command-status) 52 (concat (if (= 0 eshell-last-command-status)
53 "^_^ " 53 "^_^ "
54 ";_; ") 54 ";_; ")
55 (abbreviate-file-name (eshell/pwd)) 55 (abbreviate-file-name (eshell/pwd))
56 (if (= (user-uid) 0) " # " " $ "))) 56 (if (= (user-uid) 0) " # " " $ ")))
57 57
58 58
59;;; Packages 59;;; Packages
@@ -89,20 +89,20 @@
89 (require 'esh-module) 89 (require 'esh-module)
90 (require 'em-smart) 90 (require 'em-smart)
91 (require 'em-tramp) 91 (require 'em-tramp)
92 (setopt eshell-destroy-buffer-when-process-dies t 92 (setq eshell-destroy-buffer-when-process-dies t
93 eshell-error-if-no-glob t 93 eshell-error-if-no-glob t
94 eshell-hist-ignoredups t 94 eshell-hist-ignoredups t
95 eshell-kill-on-exit t 95 eshell-kill-on-exit t
96 eshell-prefer-lisp-functions t 96 eshell-prefer-lisp-functions t
97 eshell-prefer-lisp-variables t 97 eshell-prefer-lisp-variables t
98 eshell-scroll-to-bottom-on-input 'this 98 eshell-scroll-to-bottom-on-input 'this
99 eshell-banner-message "" 99 eshell-banner-message ""
100 eshell-hist-ignoredups 'erase 100 eshell-hist-ignoredups 'erase
101 eshell-history-size 512 101 eshell-history-size 512
102 eshell-input-filter (lambda (input) 102 eshell-input-filter (lambda (input)
103 (or (eshell-input-filter-default input) 103 (or (eshell-input-filter-default input)
104 (eshell-input-filter-initial-space input))) 104 (eshell-input-filter-initial-space input)))
105 eshell-prompt-function #'acdw/eshell-prompt) 105 eshell-prompt-function #'acdw/eshell-prompt)
106 (add-hook 'eshell-mode-hook 106 (add-hook 'eshell-mode-hook
107 (defun eshell-setup () 107 (defun eshell-setup ()
108 (hungry-delete-mode -1) 108 (hungry-delete-mode -1)
diff --git a/lisp/acdw-web.el b/lisp/acdw-web.el index 40e1a3d..3b78e4d 100644 --- a/lisp/acdw-web.el +++ b/lisp/acdw-web.el
@@ -30,6 +30,7 @@ This is a good function to use in key positions in `browse-url-handlers'."
30 (cl-loop for regexp in ',regexps 30 (cl-loop for regexp in ',regexps
31 if (string-match-p regexp url) 31 if (string-match-p regexp url)
32 return regexp))) 32 return regexp)))
33
33;;; External URL handlers 34;;; External URL handlers
34 35
35(cl-defmacro +browse-url-make-external-viewer-handler 36(cl-defmacro +browse-url-make-external-viewer-handler
@@ -93,9 +94,8 @@ for some reason."
93 "--cache-pause-initial=yes") 94 "--cache-pause-initial=yes")
94 :prompt "Video URL: ") 95 :prompt "Video URL: ")
95 96
96(+browse-url-make-external-viewer-handler mpv-image 97(+browse-url-make-external-viewer-handler miv
97 :program (executable-find "mpv") 98 :program (executable-find "miv")
98 :args '("--image-display-duration=inf")
99 :prompt "Image URL: ") 99 :prompt "Image URL: ")
100 100
101;;; External domains 101;;; External domains
@@ -187,6 +187,17 @@ This function will also save `custom-file' with the updated value."
187 (message "Saved %s" file) 187 (message "Saved %s" file)
188 file))) 188 file)))
189 189
190;;; Unfucking the internet
191
192(defun eww-archiveis-url (url)
193 "Run URL through archive.is and browse the result."
194 (interactive (list (plist-get eww-data :url)))
195 (letrec ((nonce (lambda ()
196 (unwind-protect (eww-readable)
197 (remove-hook 'eww-after-render-hook nonce)))))
198 (add-hook 'eww-after-render-hook nonce)
199 (eww (format "https://archive.is/submit/?url=%s" url))))
200
190 201
191;;; Packages 202;;; Packages
192 203
@@ -240,7 +251,8 @@ This function will also save `custom-file' with the updated value."
240 (define-key eww-mode-map "b" #'bookmark-set) 251 (define-key eww-mode-map "b" #'bookmark-set)
241 (define-key eww-mode-map "B" #'bookmark-jump) 252 (define-key eww-mode-map "B" #'bookmark-jump)
242 (define-key eww-mode-map (kbd "M-n") nil) 253 (define-key eww-mode-map (kbd "M-n") nil)
243 (define-key eww-mode-map (kbd "M-p") nil)) 254 (define-key eww-mode-map (kbd "M-p") nil)
255 (define-key eww-mode-map (kbd "*") #'eww-archiveis-url))
244 256
245(use-package browse-url 257(use-package browse-url
246 :demand t 258 :demand t
@@ -248,6 +260,9 @@ This function will also save `custom-file' with the updated value."
248 (put 'browse-url-browser-function 'safe-local-variable 260 (put 'browse-url-browser-function 'safe-local-variable
249 '+browse-url-browser-function-safe-p) 261 '+browse-url-browser-function-safe-p)
250 (setopt browse-url-browser-function #'eww-browse-url 262 (setopt browse-url-browser-function #'eww-browse-url
263 browse-url-secondary-browser-function #'browse-url-firefox
264 browse-url-firefox-program (executable-find "firefox")
265 browse-url-firefox-arguments '("--new-tab")
251 ;; Dispatch browser based on URL 266 ;; Dispatch browser based on URL
252 browse-url-handlers 267 browse-url-handlers
253 `(;; Videos 268 `(;; Videos
@@ -266,7 +281,7 @@ This function will also save `custom-file' with the updated value."
266 (rx "." (or "jpeg" "jpg" "png" "pn" 281 (rx "." (or "jpeg" "jpg" "png" "pn"
267 "bmp" "webp") 282 "bmp" "webp")
268 eos)) 283 eos))
269 . +browse-url-with-mpv-image) 284 . +browse-url-with-miv)
270 ;; Blobs 285 ;; Blobs
271 (,(+browse-url-matches (rx "." (or ".tar.gz" ".pdf") eos)) 286 (,(+browse-url-matches (rx "." (or ".tar.gz" ".pdf") eos))
272 . +browse-url-download) 287 . +browse-url-download)
@@ -294,7 +309,8 @@ This function will also save `custom-file' with the updated value."
294 browse-url-firefox-arguments '("--new-tab") 309 browse-url-firefox-arguments '("--new-tab")
295 browse-url-generic-program firefox 310 browse-url-generic-program firefox
296 browse-url-generic-args browse-url-firefox-arguments)) 311 browse-url-generic-args browse-url-firefox-arguments))
297 (when-let ((chromium (choose-executable "chromium"))) 312 (when-let ((chromium (choose-executable "chromium"
313 "chromium-browser")))
298 (setopt browse-url-chromium-program chromium 314 (setopt browse-url-chromium-program chromium
299 browse-url-generic-program chromium)) 315 browse-url-generic-program chromium))
300 (when-let ((chrome (choose-executable "chrome" 316 (when-let ((chrome (choose-executable "chrome"
@@ -304,7 +320,7 @@ This function will also save `custom-file' with the updated value."
304 320
305(use-package browse-url-transform 321(use-package browse-url-transform
306 :after browse-url 322 :after browse-url
307 :load-path "~/src/emacs/browse-url-transform/" 323 :load-path "~/src/browse-url-transform.el/"
308 :config 324 :config
309 (setopt browse-url-transform-alist 325 (setopt browse-url-transform-alist
310 `(;; Privacy-respecting alternatives 326 `(;; Privacy-respecting alternatives
diff --git a/lisp/acdw.el b/lisp/acdw.el index 63291d3..b76b947 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el
@@ -59,6 +59,13 @@ enables passing arguments to a calling function."
59 ("—" "---")))) 59 ("—" "---"))))
60 (replace-match replace nil nil))))) 60 (replace-match replace nil nil)))))
61 61
62(defun unsmartify-dwim ()
63 "Unsmartify the current region or the entire buffer."
64 (interactive)
65 (if (region-active-p)
66 (unsmartify-region (region-beginning) (region-end))
67 (unsmartify-region (point-min) (point-max))))
68
62(defun ++concat (func strings) 69(defun ++concat (func strings)
63 "Concat STRINGS processed by FUNC. 70 "Concat STRINGS processed by FUNC.
64Each of STRINGS can be a bare string or a list. Strings are 71Each of STRINGS can be a bare string or a list. Strings are