summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--custom/jao-custom-eww.el28
-rw-r--r--custom/jao-custom-gnus.el79
-rw-r--r--custom/jao-custom-notmuch.el13
-rw-r--r--init.el41
-rw-r--r--lib/doc/jao-org-notes.el15
-rw-r--r--lib/media/jao-mpc.el3
-rw-r--r--lib/media/jao-random-album.el12
-rw-r--r--lib/net/jao-notmuch-gnus.el (renamed from attic/elisp/jao-notmuch-gnus.el)10
-rw-r--r--lib/themes/jao-light-theme.el1
-rw-r--r--lib/themes/jao-themes.el2
10 files changed, 134 insertions, 70 deletions
diff --git a/custom/jao-custom-eww.el b/custom/jao-custom-eww.el
index a3f4df9..6a2e8e2 100644
--- a/custom/jao-custom-eww.el
+++ b/custom/jao-custom-eww.el
@@ -121,11 +121,11 @@
(let ((shr-width 80)) (eww-readable)))
(let* ((start (if (org-region-active-p) (region-beginning) (point-min)))
(end (if (org-region-active-p) (region-end) (point-max)))
- (buff (or dest (generate-new-buffer "*eww-to-org*")))
(link (eww-current-url))
- (title (or (plist-get eww-data :title) "")))
+ (title (plist-get eww-data :title))
+ (buff (save-current-buffer (or dest (jao-org-notes-create title)))))
(with-current-buffer buff
- (insert "#+title: " title "\n#+link: " link "\n\n")
+ (insert "#+link: " link "\n\n")
(org-mode))
(save-excursion
(goto-char start)
@@ -183,6 +183,15 @@ It should be the title of the web page as returned by `rdrview'"
(if eww-rdrview-mode (eww-rdrview-mode -1)
(eww-rdrview-mode 1))
(eww-reload))
+;;; auto-readable
+(defvar jao-eww-auto-readable-urls
+ (regexp-opt '("guardian.co.uk" "theguardian.com" "github.com" "eldiario.es")))
+
+(defun jao-eww-autoread ()
+ (when (string-match-p jao-eww-auto-readable-urls (or (eww-current-url)))
+ (eww-readable)))
+
+(add-hook 'eww-after-render-hook #'jao-eww-autoread)
;;; package
(use-package shr
:custom ((shr-width nil)
@@ -246,16 +255,6 @@ It should be the title of the web page as returned by `rdrview'"
("C-c C-w" . jao-eww-close)
("M-i" . eww-toggle-images))))
-;;; auto-readable
-(defvar jao-eww-auto-readable-urls
- (regexp-opt '("guardian.co.uk" "theguardian.com" "github.com" "eldiario.es")))
-
-(defun jao-eww-autoread ()
- (when (string-match-p jao-eww-auto-readable-urls (or (eww-current-url)))
- (eww-readable)))
-
-(add-hook 'eww-after-render-hook #'jao-eww-autoread)
-
;;; fixes for shr image rendering
(require 'shr)
@@ -279,5 +278,8 @@ It should be the title of the web page as returned by `rdrview'"
(advice-add 'shr-tag-img :around #'jao-shr-tag-img)
(advice-add 'shr-insert :around #'jao-shr-insert)
+;; (advice-remove 'shr-tag-img #'jao-shr-tag-img)
+;; (advice-remove 'shr-insert #'jao-shr-insert)
+
;;; .
(provide 'jao-custom-eww)
diff --git a/custom/jao-custom-gnus.el b/custom/jao-custom-gnus.el
index 0d75b43..70823ef 100644
--- a/custom/jao-custom-gnus.el
+++ b/custom/jao-custom-gnus.el
@@ -114,7 +114,7 @@
(cl-defmethod gnus-search-indexed-search-command ((engine gnus-search-recoll)
(qstring string)
- _query
+ query
&optional groups)
(let* ((subdir (slot-value engine 'remove-prefix))
(sep (slot-value engine 'separator))
@@ -128,8 +128,18 @@
(mapconcat (lambda (d) (format "dir:%s" d))
gdirs " OR ")
")")))
- (q (concat "mime:message " dirsq " (" qstring ")")))
- ;; (message "query is: %s" q)
+ (qstring (if (string-prefix-p "id:" qstring)
+ (replace-regexp-in-string "<\\|>" "\"" qstring)
+ qstring))
+ (qstring (if (cdr (assoc 'thread query))
+ (concat qstring " OR "
+ (replace-regexp-in-string "id:\"" "ref:\""
+ qstring))
+ qstring))
+ (qstring (replace-regexp-in-string " or " " OR " qstring))
+ (qstring (replace-regexp-in-string " and " " AND " qstring))
+ (q (format "mime:message %s (%s)" dirsq qstring)))
+ ;; (message "query is: %s -- %S" q query)
`("-b" "-t" "-q" ,q))))
;; (add-to-list 'gnus-parameters '("^nnselect:.*" (nnselect-rescan . t)))
@@ -438,19 +448,37 @@
:config
(add-to-list 'org-capture-templates
'("X" "arXiv" entry (file "notes/physics/arxiv.org")
- "* %:subject\n %i" :immediate-finish t)
+ "* %:subject\n\n(jao-gnus-org-paragraph \"%i\")"
+ :immediate-finish t)
t)
(org-capture-upgrade-templates org-capture-templates))
+(defvar jao-gnus-org-url nil)
+(defun jao-gnus-org-paragraph (x)
+ (with-temp-buffer
+ (insert " " (string-trim (or x "")) "\n ")
+ (goto-char 0)
+ (fill-paragraph)
+ (goto-char (point-max))
+ (open-rectangle 0 (point))
+ (concat (buffer-string) "\n " (or jao-gnus-org-url ""))))
+
(defun jao-gnus-arXiv-capture ()
(interactive)
+ (unless (derived-mode-p '(gnus-summary-mode)) (gnus-article-show-summary))
+ (setq jao-subject (gnus-summary-article-subject))
(gnus-summary-select-article-buffer)
(gnus-article-goto-part 0)
- (forward-paragraph)
(setq-local transient-mark-mode 'lambda)
(set-mark (point))
- (goto-char (point-max))
- (org-capture nil "X"))
+ (forward-paragraph)
+ (save-excursion
+ (when (re-search-forward "^Link" nil t)
+ (beginning-of-line)
+ (setq jao-gnus-org-url (org-eww-url-below-point))))
+ (org-capture nil "X")
+ (set-mark (point))
+ (gnus-article-show-summary))
;;; article
;;;; config, headers
@@ -533,9 +561,18 @@
(search-forward-regexp "^URL: h" nil t)
(and (search-forward-regexp "^Link$" nil t)
(not (beginning-of-line))))
- (if external
- (jao-browse-with-external-browser)
- (browse-url (jao-url-around-point))))))
+ (cond (external (jao-browse-with-external-browser))
+ ((featurep 'jao-custom-eww) (eww (jao-url-around-point)))
+ (t (browse-url (jao-url-around-point)))))))
+
+(defun jao-gnus-from-eww (keep-eww-buffer)
+ (interactive "P")
+ (unless keep-eww-buffer (jao-eww-close))
+ (jao-afio-goto-mail)
+ (gnus-article-show-summary))
+
+(with-eval-after-load 'eww
+ (define-key eww-mode-map (kbd "h") #'jao-gnus-from-eww))
(defun jao-gnus-open-enclosure ()
(interactive)
@@ -576,7 +613,16 @@
(gnus-demon-scan-news)
(jao-gnus--notify)))
-(gnus-demon-add-handler 'jao-gnus--scan 5 1)
+(defun jao-gnus-add-demon ()
+ (interactive)
+ (gnus-demon-add-handler 'jao-gnus--scan 5 1))
+
+(jao-gnus-add-demon)
+(gnus-demon-init)
+
+;; this is, in theory, not needed; but at some point in the way to emacs
+;; version 31 this idle timers have ceased to work after a sleep/awake cycle
+(add-to-list 'jao-sleep-awake-functions #'jao-gnus-add-demon)
;;; add-ons
;;;; notifications
@@ -592,7 +638,7 @@
("nnml:jao\\.\\(inbox\\|trove\\)" "I" jao-themes-f01)
("nnml:bigml\\.[^aibs]" "W" jao-themes-dimm)
("nnml:jao.hacking" "H" jao-themes-dimm)
- ("nnml:jao.write" "W" jao-themes-error)
+ ("nnml:jao.write" "W" jao-themes-warning)
("nnml:jao.[^isthw]" "J" jao-themes-dimm)
(,(format "^nnml:%s" (regexp-opt feeds)) "F" jao-themes-dimm)
("feeds\\.e" "E" jao-themes-dimm)
@@ -717,6 +763,15 @@
(with-eval-after-load "consult-recoll"
(add-to-list 'consult-recoll-open-fns
'("message/rfc822" . jao-gnus-goto-file))))
+;;;; notmuch
+(use-package jao-notmuch-gnus
+ :demand t)
+
+(jao-load-path "consult-notmuch")
+
+(use-package consult-notmuch
+ :bind (:map gnus-group-mode-map ("S" . #'jao-gnus-consult-notmuch)))
+
;;; keyboard shortcuts
(define-key gnus-article-mode-map "i" 'jao-gnus-show-images)
(define-key gnus-summary-mode-map "i" 'jao-gnus-show-images)
diff --git a/custom/jao-custom-notmuch.el b/custom/jao-custom-notmuch.el
index 3919897..42d9e12 100644
--- a/custom/jao-custom-notmuch.el
+++ b/custom/jao-custom-notmuch.el
@@ -588,12 +588,13 @@
;;; arXiv
(use-package org-capture
:config
- (add-to-list 'org-capture-templates
- '("X" "arXiv" entry (file "notes/physics/arxiv.org")
- "* %(jao-org-notmuch-last-subject)\n %i"
- :immediate-finish t)
- t)
- (org-capture-upgrade-templates org-capture-templates))
+ (when jao-notmuch-enabled
+ (add-to-list 'org-capture-templates
+ '("X" "arXiv" entry (file "notes/physics/arxiv.org")
+ "* %(jao-org-notmuch-last-subject)\n %i"
+ :immediate-finish t)
+ t)
+ (org-capture-upgrade-templates org-capture-templates)))
(defun jao-notmuch-arXiv-capture ()
(interactive)
diff --git a/init.el b/init.el
index a6de341..809009e 100644
--- a/init.el
+++ b/init.el
@@ -94,7 +94,7 @@
(jao-load-site-el "pre")
;;; System Utilities
-;;; persist
+;;;; persist
(require 'persist)
;;;; (no) backups
@@ -525,7 +525,8 @@
battery-mode-line-format " 🔋%b%p% "))
(with-eval-after-load "jao-minibuffer"
- (when jao-mode-line-in-minibuffer
+ (if jao-mode-line-in-minibuffer
+ (display-battery-mode 1)
(jao-minibuffer-add-variable 'battery-mode-line-string 80)))
;;; Notifications
@@ -1117,8 +1118,9 @@
global-dictionary-tooltip-mode)
:bind (("C-c d" . dictionary-search)))
-(setq ispell-personal-dictionary
- (expand-file-name "~/.emacs.d/ispell.dict"))
+(use-package ispell
+ :custom ((ispell-personal-dictionary
+ (expand-file-name "~/.emacs.d/ispell.dict"))))
(use-package reverso
:ensure t
@@ -1342,7 +1344,7 @@
'("ps" "pdf" "dvi" "djvu" "zip" "gz" "tgz"))
(defvar jao-browse-external-domains
- '("github.com" "gitlab.com" "slack.com" "spotify.com"
+ '("github.com" "gitlab.com" "slack.com" "spotify.com" "drive.google.com"
"meet.google.com" "docs.google.com" "x.com" "twitter.com"
"t.com" "linkedin.com" "bigml.com" "slack.com" "zoom.us"))
@@ -2427,10 +2429,10 @@
(tramp-get-completion-function "ssh"))
#'string=))
-(defun jao-ssh ()
- (interactive)
+(defun jao-ssh (&optional scratch)
+ (interactive "P")
(let ((h (completing-read "Host: " (jao-tramp-hosts))))
- (jao-afio-goto-scratch)
+ (when scratch (jao-afio-goto-scratch))
(jao-exec-in-term (format "ssh %s" h) (format "*ssh %s*" h))))
;;; Chats
@@ -2483,8 +2485,9 @@
:lighter (:eval (format " [%s]" (jao-circe-nick-no))))
(defun jao-circe-channel-hook ()
- ;; (setq header-line-format
- ;; '(" %b" (:eval (format " - %s nicks" (jao-circe-nick-no)))))
+ (when jao-mode-line-in-minibuffer
+ (setq header-line-format
+ '(" %b" (:eval (format " - %s nicks" (jao-circe-nick-no))))))
(jao-circe-user-number-mode 1))
(add-hook 'circe-channel-mode-hook #'jao-circe-channel-hook)
@@ -2605,8 +2608,8 @@
(use-package mastodon
:ensure t
:init
- (setq mastodon-instance-url "https://emacs.ch"
- mastodon-active-user "mail@jao.io"
+ (setq mastodon-instance-url "https://fosstodon.org"
+ mastodon-active-user "jao@gnu.org"
mastodon-tl-position-after-update nil
mastodon-toot-display-orig-in-reply-buffer t)
:config
@@ -2964,9 +2967,13 @@
(interactive)
(jao-mpc-show-playlist jao-mopidy-port))
-(use-package jao-random-album :demand t)
-
-(jao-def-exec-in-term "aptitude" "aptitude" (jao-afio-goto-scratch))
+(use-package jao-random-album
+ :demand t
+ :config
+ (defun jao--notify-album (album)
+ (jao-notify album "Next album" jao-notify-audio-icon)
+ (jao-minibuffer-refresh))
+ (setq jao-random-album-notify #'jao--notify-album))
(defun jao-toggle-pasystray-applet ()
(interactive)
@@ -3254,6 +3261,7 @@
(outline-show-entry))
((derived-mode-p 'org-mode) (org-reveal))))
+(jao-def-exec-in-term "aptitude" "aptitude" (jao-afio-goto-scratch))
(jao-def-exec-in-term "htop" "htop" (jao-afio-goto-scratch))
(transient-define-prefix jao-transient-utils ()
@@ -3274,14 +3282,13 @@
("x" "restart xmobar" jao-xmobar-restart :if jao-exwm-enabled-p)
("x" "kill xmobar" jao-xmobar-kill :if jao-xmonad-enabled-p)]
["Network"
- ("S" "ssh" jao-ssh)
+ ("s" "ssh" jao-ssh)
("b" "bluetooth" bluetooth-list-devices)
("c" "connect chats" jao-all-chats)
("m" "proton bridge" run-proton-bridge)
("v" "view video" jao-view-video)]
["Chats"
("t" "telegram" jao-chats-telega)
- ("s" "slack" jao-chats-slack)
("i" "irc" jao-chats-irc)
("M" "mastodon" jao-mastodon)
("T" "telegram rooster" jao-telega)]
diff --git a/lib/doc/jao-org-notes.el b/lib/doc/jao-org-notes.el
index bd82543..43b8c09 100644
--- a/lib/doc/jao-org-notes.el
+++ b/lib/doc/jao-org-notes.el
@@ -71,13 +71,13 @@
(and (string-match-p "^[^:]+ + :" m) "tags")
"titles"))
-(defun jao-org-notes--consult-rg (prompt &optional cat no-req cmd)
+(defun jao-org-notes--consult-rg (prompt &optional cat no-req cmd initial)
(let ((default-directory (expand-file-name (or cat "") jao-org-notes-dir)))
(consult--read
(consult--async-command #'jao-org-notes--rg-title-or-tags
(consult--async-transform jao-org-notes--matches))
:prompt prompt
- :initial (consult--async-split-initial "")
+ :initial (consult--async-split-initial (or initial ""))
:add-history (concat (consult--async-split-initial (thing-at-point 'symbol)))
:require-match (not no-req)
:category 'jao-org-notes-lookup
@@ -94,9 +94,10 @@
(cond ((file-exists-p (expand-file-name cat jao-org-notes-dir)) cat)
((yes-or-no-p "New category, create?") cat))))
-(defun jao-org-notes--insert-title ()
+(defun jao-org-notes--insert-title (&optional title)
(let* ((cat (jao-org-notes--cat))
- (title (file-name-base (jao-org-notes--consult-rg "Title: " cat t)))
+ (note (jao-org-notes--consult-rg "Title: " cat t nil title))
+ (title (file-name-base note))
(title (replace-regexp-in-string "^#" "" title)))
(when (not (string-empty-p title))
(let* ((base (replace-regexp-in-string " +" "-" (downcase title)))
@@ -160,16 +161,16 @@
(interactive)
(consult-ripgrep (expand-file-name (or cat "") jao-org-notes-dir) initial))
-(defun jao-org-notes-create ()
+(defun jao-org-notes-create (&optional title)
"Create a new note file, matching tags and titles with completion."
(interactive)
- (when (jao-org-notes--insert-title)
+ (when (jao-org-notes--insert-title title)
(org-insert-time-stamp (current-time) t t "#+date: " "\n")
(insert "#+tags: :"
(mapconcat #'identity (jao-org-notes--read-tags) ":")
":\n"))
(save-buffer)
- (buffer-file-name))
+ (current-buffer))
(defun jao-org-notes-backlinks ()
"Show a list of note files linking to the current one."
diff --git a/lib/media/jao-mpc.el b/lib/media/jao-mpc.el
index 0f000da..4f5081c 100644
--- a/lib/media/jao-mpc.el
+++ b/lib/media/jao-mpc.el
@@ -311,8 +311,7 @@
(setq jao-lyrics-info-function #'jao-mpc-lyrics-track-data)
(jao-random-album-setup #'jao-mpc--album-buffer
#'jao-mpc--add-and-play
- #'jao-mpc-stop
- jao-notify-audio-icon)
+ #'jao-mpc-stop)
(let ((jao-random-album-active nil)) (jao-mpc-connect))
(when secondary-port (jao-mpc-connect secondary-port))
(when priority
diff --git a/lib/media/jao-random-album.el b/lib/media/jao-random-album.el
index 5b10308..3b2915b 100644
--- a/lib/media/jao-random-album.el
+++ b/lib/media/jao-random-album.el
@@ -18,13 +18,10 @@
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
-(require 'jao-notify)
-
(defvar jao-random-album-active t)
(defvar jao-random-lines nil)
(defvar jao-random-lines-file (expand-file-name "~/.emacs.d/random-lines"))
-(defvar jao-random-album-notify t)
-(defvar jao-random-album-notify-icon jao-notify-audio-icon)
+(defvar jao-random-album-notify nil)
(defvar jao-random-album-skip-lines 2)
(defun jao-random-lines ()
@@ -81,18 +78,17 @@
(let ((album (string-trim (thing-at-point 'line))))
(funcall jao-random-album-add-tracks-and-play album)
(when jao-random-album-notify
- (jao-notify album "Next album" jao-random-album-notify-icon)))))
+ (funcall jao-random-album-notify album)))))
(defun jao-random-album-reset ()
(interactive)
(setq jao-random-lines nil)
(jao-random-lines-save))
-(defun jao-random-album-setup (album-buffer add-and-play stop &optional icon)
+(defun jao-random-album-setup (album-buffer add-and-play stop)
(setq jao-random-album-buffer album-buffer
jao-random-album-add-tracks-and-play add-and-play
- jao-random-album-stop stop
- jao-random-album-notify-icon icon))
+ jao-random-album-stop stop))
(provide 'jao-random-album)
diff --git a/attic/elisp/jao-notmuch-gnus.el b/lib/net/jao-notmuch-gnus.el
index 1576964..f5cc3b2 100644
--- a/attic/elisp/jao-notmuch-gnus.el
+++ b/lib/net/jao-notmuch-gnus.el
@@ -1,6 +1,6 @@
;;; jao-notmuch-gnus.el --- notmuch-gnus interoperability -*- lexical-binding: t; -*-
-;; Copyright (C) 2022 jao
+;; Copyright (C) 2022, 2024 jao
;; Author: jao <mail@jao.io>
;; Keywords: mail
@@ -101,6 +101,8 @@
;;; Gnus search using notmuch
+(require 'gnus-search)
+
(add-to-list 'gnus-search-expandable-keys "list")
(cl-defmethod gnus-search-transform-expression ((engine gnus-search-notmuch)
@@ -113,10 +115,10 @@
(defvar jao-notmuch-gnus-server "nnml"
"Name of the target Gnus server, e.g. nnml+mail.")
-(defvar jao-notmuch-gnus-mail-directory (expand-file-name "~/.emacs.d/gnus/Mail")
+(defvar jao-notmuch-gnus-mail-directory (expand-file-name "~/var/mail/gnus")
"Directory where Gnus stores its mail.")
-(defvar jao-notmuch-gnus-leafnode-directory (expand-file-name "~/var/news")
+(defvar jao-notmuch-gnus-leafnode-directory (expand-file-name "~/var/mail/news")
"Directory where leafnode stores its messages as seen by notmuch.")
(defun jao-notmuch-gnus-file-to-group (file &optional maildir newsdir)
@@ -212,7 +214,7 @@ Example:
(defun jao-notmuch-gnus--open-candidate (candidate)
"Open a notmuch-search completion candidate email in Gnus."
(message "candidate: %S" candidate)
- (jao-notmuch-gnus-goto-message (consult-notmuch--thread-id candidate)))
+ (jao-notmuch-gnus-goto-message (consult-notmuch--candidate-id candidate)))
(defun jao-gnus-consult-notmuch ()
"Run a consult-notmuch query that opens candidates in Gnus."
diff --git a/lib/themes/jao-light-theme.el b/lib/themes/jao-light-theme.el
index a172f84..659b6bb 100644
--- a/lib/themes/jao-light-theme.el
+++ b/lib/themes/jao-light-theme.el
@@ -115,6 +115,7 @@
(shr-link (~ link) (ul light-gray))
(shr-code (c blue nil))
(success (c green))
+ (variable-pitch :family "Iosevka Etoile" :height 90)
(vertical-border (c "grey70" nil))
(vterm-color-yellow (c "darkgoldenrod4" yellow))
(widget-button (~ default) nit (ul "grey80"))))
diff --git a/lib/themes/jao-themes.el b/lib/themes/jao-themes.el
index b1aa265..58d32a0 100644
--- a/lib/themes/jao-themes.el
+++ b/lib/themes/jao-themes.el
@@ -314,7 +314,7 @@
(ansi-color-green (c "darkseagreen4" "darkseagreen4"))
(ansi-color-magenta (c "lightpink3" "lightpink3"))
(ansi-color-yellow (c "lightgoldenrod3" "lightgoldenrod3"))
- (avy-lead-face (c "red" "grey90") bf :height 1.2)
+ (avy-lead-face (c "red" "grey90") bf :height 1.0)
(avy-lead-face-0 (~ avy-lead-face) bf)
(avy-lead-face-1 (~ avy-lead-face)))
`((bbdb-company)