diff options
-rw-r--r-- | custom/jao-custom-completion.el | 5 | ||||
-rw-r--r-- | custom/jao-custom-eww.el | 35 | ||||
-rw-r--r-- | custom/jao-custom-exwm.el | 5 | ||||
-rw-r--r-- | custom/jao-custom-gnus.el | 110 | ||||
-rw-r--r-- | custom/jao-custom-notmuch.el | 13 | ||||
-rw-r--r-- | init.el | 163 | ||||
-rw-r--r-- | lib/doc/jao-org-notes.el | 24 | ||||
-rw-r--r-- | lib/eos/jao-afio.el | 4 | ||||
-rw-r--r-- | lib/eos/jao-dirmon.el | 11 | ||||
-rw-r--r-- | lib/eos/jao-minibuffer.el | 6 | ||||
-rw-r--r-- | lib/media/jao-mpc.el | 3 | ||||
-rw-r--r-- | lib/media/jao-mpris.el | 32 | ||||
-rw-r--r-- | lib/media/jao-random-album.el | 12 | ||||
-rw-r--r-- | lib/net/jao-notmuch-gnus.el (renamed from attic/elisp/jao-notmuch-gnus.el) | 34 | ||||
-rw-r--r-- | lib/net/randomsig.el | 9 | ||||
-rw-r--r-- | lib/themes/jao-light-theme.el | 1 | ||||
-rw-r--r-- | lib/themes/jao-themes.el | 5 |
17 files changed, 324 insertions, 148 deletions
diff --git a/custom/jao-custom-completion.el b/custom/jao-custom-completion.el index 9524e23..490fd65 100644 --- a/custom/jao-custom-completion.el +++ b/custom/jao-custom-completion.el @@ -87,7 +87,7 @@ (funcall fun lines) (move-overlay vertico--candidates-ov (point-min) (point-min)) (overlay-put vertico--candidates-ov 'after-string (apply #'concat lines)) - (vertico--resize-window (length lines)))) + (vertico--resize))) (advice-add 'vertico--display-candidates :around #'jao-vertico--display)) @@ -126,8 +126,7 @@ ("M-g e" . consult-error) ("M-s m" . consult-multi-occur) ("M-y" . consult-yank-pop) - ("C-s" . isearch-forward) - ("<help> a" . consult-apropos)) + ("C-s" . isearch-forward)) :custom ((consult-preview-key (kbd "`"))) diff --git a/custom/jao-custom-eww.el b/custom/jao-custom-eww.el index a3f4df9..1b766c9 100644 --- a/custom/jao-custom-eww.el +++ b/custom/jao-custom-eww.el @@ -116,16 +116,17 @@ ;;; eww to org (defun jao-eww-to-org (&optional dest) - (interactive) - (unless (org-region-active-p) + (interactive "P") + (unless (or (and (interactive-p) dest) (org-region-active-p)) (let ((shr-width 80)) (eww-readable))) - (let* ((start (if (org-region-active-p) (region-beginning) (point-min))) + (let* ((dest (unless (interactive-p) dest)) + (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 +184,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 +256,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 +279,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-exwm.el b/custom/jao-custom-exwm.el index e5c67f8..3cb3fc9 100644 --- a/custom/jao-custom-exwm.el +++ b/custom/jao-custom-exwm.el @@ -194,7 +194,9 @@ (defun jao-exwm-switch-to-next-x () (interactive) - (let ((bfs (seq-filter (lambda (b) (buffer-local-value 'exwm-class-name b)) + (let ((bfs (seq-filter (lambda (b) + (with-current-buffer b + (derived-mode-p 'exwm-mode))) (buffer-list (window-frame))))) (when (car bfs) (switch-to-buffer (car (reverse bfs)))))) @@ -530,6 +532,7 @@ ([f9] . jao-bright-show))) ;; (customize-set-variable 'exwm-input-global-keys exwm-input-global-keys) +(exwm-wm-mode) ;;; . (provide 'jao-custom-exwm) diff --git a/custom/jao-custom-gnus.el b/custom/jao-custom-gnus.el index 0d75b43..ce77285 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))) @@ -202,8 +212,10 @@ (when jao-gnus-use-nnml (add-to-list 'gnus-secondary-select-methods - `(nnml "" (gnus-search-engine gnus-search-recoll - (remove-prefix ,(jao-gnus-dir "Mail/")))))) + ;; `(nnml "" (gnus-search-engine gnus-search-recoll + ;; (remove-prefix ,(jao-gnus-dir "Mail/")))) + `(nnml "" (gnus-search-engine gnus-search-notmuch + (remove-prefix "/home/jao/var/mail/gnus"))))) (when jao-gnus-use-nnml (dolist (p jao-gnus-nnml-group-params) @@ -437,20 +449,49 @@ (use-package org-capture :config (add-to-list 'org-capture-templates + '("x" "arXiv" entry (file "notes/physics/arxiv.org") + "* %(jao-gnus-subject)\n\n %i\n\n %(jao-gnus-org-url)" + :immediate-finish t) + t) + (add-to-list 'org-capture-templates '("X" "arXiv" entry (file "notes/physics/arxiv.org") - "* %:subject\n %i" :immediate-finish t) + "* %(jao-gnus-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-url () jao-gnus-org-url) +(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 "")))) +(defvar jao-gnus-subject nil) +(defun jao-gnus-subject () jao-gnus-subject) + (defun jao-gnus-arXiv-capture () (interactive) + (unless (derived-mode-p '(gnus-summary-mode)) (gnus-article-show-summary)) + (setq jao-gnus-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")) + (let ((transient-mark-mode t)) + (set-mark (point)) + (forward-paragraph) + (or (and (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")) + (and (save-excursion + (when (re-search-forward "^URL: " nil t) + (setq jao-gnus-org-url (thing-at-point-url-at-point)))) + (org-capture nil "x")))) + (gnus-article-show-summary)) ;;; article ;;;; config, headers @@ -530,12 +571,21 @@ (save-excursion (goto-char (point-min)) (when (or (search-forward-regexp "^Via: h" nil t) - (search-forward-regexp "^URL: h" nil t) + (search-forward-regexp "^URL:[\n ]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) @@ -543,7 +593,7 @@ (gnus-summary-select-article-buffer) (save-excursion (goto-char (point-min)) - (let ((offset (or (and (search-forward-regexp "^Enclosure: " nil t) 2) + (let ((offset (or (and (search-forward-regexp "^Enclosure: ?" nil t) 2) (and (search-forward-regexp "^Enclosure$" nil t) -2)))) (when offset (forward-char offset)) (if-let ((url (jao-url-around-point))) @@ -576,7 +626,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 @@ -587,13 +646,14 @@ (seq-difference '("feeds.trove"))))) `(("nnml:bigml\\.inbox" "B" jao-themes-f00) ("nnml:bigml\\.alba" "A" jao-themes-f00) + ("nnml:bigml\\.ryou" "R" jao-themes-f00) ("nnml:bigml\\.bugs" "b" jao-themes-error) ("nnml:bigml\\.support" "S" default) + ("nnml:bigml\\.[^aibsr]" "W" jao-themes-dimm) ("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.[^isthw]" "J" jao-themes-dimm) + ("nnml:jao.write" "W" jao-themes-warning) + ("nnml:jao.[^ithw]" "J" jao-themes-dimm) (,(format "^nnml:%s" (regexp-opt feeds)) "F" jao-themes-dimm) ("feeds\\.e" "E" jao-themes-dimm) ("nnml:local" "l" jao-themes-dimm) @@ -643,6 +703,7 @@ (jao-gnus--notify))) (add-hook 'gnus-summary-exit-hook #'jao-gnus--on-summary-exit) +(add-hook 'gnus-exit-group-hook #'jao-gnus--notify) ;;;; open mail file in gnus (defun jao-gnus-file-to-group (file &optional maildir newsdir m-server n-server) @@ -717,6 +778,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) @@ -94,7 +94,7 @@ (jao-load-site-el "pre") ;;; System Utilities -;;; persist +;;;; persist (require 'persist) ;;;; (no) backups @@ -279,7 +279,9 @@ (setq auth-sources '("~/.emacs.d/authinfo.gpg" "~/.netrc")) (use-package epa-file - :init (setq epa-file-cache-passphrase-for-symmetric-encryption t) + :init (setq epa-file-cache-passphrase-for-symmetric-encryption t + epa-file-encrypt-to "A247C4780736A6156BC8DA748C081D34D321D881" + plstore-encrypt-to epa-file-encrypt-to) :config (epa-file-enable)) (require 'epa-file) @@ -525,7 +527,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 @@ -909,6 +912,7 @@ ;;;; projects (use-package project :demand t) (global-set-key "\C-xp" 'jao-prev-window) +(use-package list-projects :ensure t) ;;;; buffer quit function (the triple ESC) (setq buffer-quit-function (lambda () t)) @@ -929,6 +933,42 @@ scroll-step 1 redisplay-skip-fontification-on-input nil)) +(use-package ultra-scroll + ;:load-path "~/code/emacs/ultra-scroll" ; if you git clone'd instead of using vc + :vc (:url "https://github.com/jdtsmith/ultra-scroll") ; For Emacs>=30 + :init + (setq scroll-conservatively 3 ; or whatever value you prefer, since v0.4 + scroll-margin 0) ; important: scroll-margin>0 not yet supported + :config + (ultra-scroll-mode 1)) + +;;;; show diffs when running C-x s +(add-to-list 'save-some-buffers-action-alist + `("d" + ,(lambda (buffer) + (diff-buffer-with-file (buffer-file-name buffer))) + "show diff between the buffer and its file")) + +;;;; copy buffer file name +;; https://stackoverflow.com/questions/18812938/copy-full-file-path-into-copy-paste-clipboard +(defun copy-buffer-file-name-as-kill (choice) + "Copy the buffer-file-name to the kill-ring" + (interactive "cCopy Buffer Name (F) Full, (D) Directory, (N) Name") + (let ((new-kill-string) + (name (if (eq major-mode 'dired-mode) + (dired-get-filename) + (or (buffer-file-name) "")))) + (cond ((eq choice ?f) + (setq new-kill-string name)) + ((eq choice ?d) + (setq new-kill-string (file-name-directory name))) + ((eq choice ?n) + (setq new-kill-string (file-name-nondirectory name))) + (t (message "Quit"))) + (when new-kill-string + (message "%s copied" new-kill-string) + (kill-new new-kill-string)))) + ;;; Windows ;;;; splitting and switch (setq split-height-threshold 80 @@ -1117,8 +1157,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 @@ -1284,9 +1325,10 @@ (defun jao-maybe-view-video (url &rest _ignored) (interactive) - (if (y-or-n-p "View video (y) or web page (n)? ") - (jao-view-video url) - (funcall jao-browse-url-function url))) + (let ((w (read-char "View video (v) or web page (w)? "))) + (cond ((eq w ?v) (jao-view-video url)) + ((eq w ?w) (funcall jao-browse-url-function url)) + (t (message "Aborted"))))) ;;;; web browsers (defun jao-www--buffer-p (b) @@ -1342,7 +1384,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")) @@ -1527,9 +1569,9 @@ :hook ((doc-view-mode . jao-doc-session-mark)) :bind (:map doc-view-mode-map ("j" . doc-view-next-line-or-next-page) - ("J" . doc-view-scroll-up-or-next-page) + ("J" . doc-view-search-next-match) ("k" . doc-view-previous-line-or-previous-page) - ("K" . doc-view-scroll-down-or-previous-page) + ("K" . doc-view-search-previous-match) ("z" . jao-open-with-zathura))) (use-package jao-doc-session :demand t) @@ -1868,10 +1910,10 @@ ;;;; other git packages (use-package git-timemachine :ensure t) -(use-package consult-git-log-grep - :ensure t - :custom (consult-git-log-grep-open-function #'magit-show-commit) - :bind (("C-c K" . consult-git-grep))) +;; (use-package consult-git-log-grep +;; :ensure t +;; :custom (consult-git-log-grep-open-function #'magit-show-commit) +;; :bind (("C-c K" . consult-git-grep))) ;; git config --local git-link.remote / git-link.branch (use-package git-link :ensure t) @@ -2076,7 +2118,7 @@ (add-hook 'emacs-lisp-mode-hook #'jao-outline-minor-mode) (use-package edit-list :ensure t) -(use-package package-lint :ensure t) +;; (use-package package-lint :ensure t) ;; (use-package tree-inspector :ensure t) (defun elisp-disassemble (function) @@ -2195,7 +2237,9 @@ (add-hook 'org-mode-hook #'jao-org--set-geiser-impl) (jao-load-path "geiser") +;; (package-vc-install-from-checkout ...) (use-package geiser + :demand t :init (setq geiser-repl-history-filename "~/.emacs.d/cache/geiser-history" geiser-repl-startup-time 20000 @@ -2384,6 +2428,11 @@ :config (venv-initialize-eshell) (jao-compilation-env "VIRTUAL_ENV")) +;;;; Javascript + +(use-package typescript-mode + :ensure t + :custom ((typescript-indent-level 2))) ;;; Text/data formats ;;;; json @@ -2427,10 +2476,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 @@ -2477,17 +2526,27 @@ lui-track-behavior 'before-tracking-next-buffer) :config - (defsubst jao-circe-nick-no () (length (circe-channel-nicks))) + (defsubst jao-circe-nick-no () + (if (derived-mode-p 'circe-query-mode) + 2 + (length (circe-channel-nicks)))) + + (defsubst jao-circe-netowrk () + (or (plist-get lui-logging-format-arguments :network) "")) (define-minor-mode jao-circe-user-number-mode "" :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 - %s nicks" + (jao-circe-netowrk) + (jao-circe-nick-no)))))) (jao-circe-user-number-mode 1)) (add-hook 'circe-channel-mode-hook #'jao-circe-channel-hook) + (add-hook 'circe-query-mode-hook #'jao-circe-channel-hook) (defun circe-command-RECOVER (&rest _ignore) "Recover nick" @@ -2520,11 +2579,13 @@ (list "Bitlbee" :host "127.0.0.1" :nick u :channels jao-bitlbee-channels :lagmon-disabled t :nickserv-password u :user p)) - (list "localslack" :host "127.0.0.1" :nick "jao" + (list "bigml" :host "127.0.0.1" :nick "jao" :channels jao-slack-channels :port 9007 :lagmon-disabled t) (list "recoveryou" :host "127.0.0.1" :nick "jao" - :port 9008 :lagmon-disabled t))) + :port 9008 :lagmon-disabled t) + (list "grio" :host "127.0.0.1" :nick "jao" + :port 9009 :lagmon-disabled t))) (jao-shorten-modes 'circe-channel-mode 'circe-server-mode @@ -2605,10 +2666,13 @@ (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-group-notifications t + mastodon-images-in-notifs t mastodon-tl-position-after-update nil - mastodon-toot-display-orig-in-reply-buffer t) + mastodon-toot-display-orig-in-reply-buffer t + mastodon-media--hide-sensitive-media nil) :config ;; (defun jao-mastodon--setup () ;; (setq-local scroll-margin 12)) @@ -2681,9 +2745,10 @@ ("M" "mute user" mastodon-tl--mute-user) ("B" "block user" mastodon-tl--block-user) ("m" "message user" mastodon-tl--dm-user) - "" - ("," "favouriters" mastodon-toot--list-toot-favouriters) - ("." "boosters" mastodon-toot--list-toot-boosters)] + ;; "" + ;; ("," "favouriters" mastodon-toot--list-toot-favouriters) + ;; ("." "boosters" mastodon-toot--list-toot-boosters) + ] ;; S-RET mastodon-tl--unmute-user ;; C-S-b mastodon-tl--unblock-user @@ -2709,15 +2774,13 @@ (jao-with-auth "matrix.org" u p (ement-connect :user-id u :password p)))) (when (and (fboundp 'mastodon) (or p (y-or-n-p "Connect to mastodon? "))) (mastodon)) - (when (or p (y-or-n-p "Connect to libera? ")) - (unless (get-buffer "irc.libera.chat:6697") - (circe "Libera Chat"))) - (when (or p (y-or-n-p "Connect to localslack? ")) - (unless (get-buffer "127.0.0.1:9007") - (circe "localslack"))) - (when (or p (y-or-n-p "Connect to recoveryou? ")) - (unless (get-buffer "127.0.0.1:9008") - (circe "recoveryou")))) + (dolist (c '(("Libera Chat" . "irc.libera.chat:6697") + ("bigml" . "127.0.0.1:9007") + ("recoveryou" . "127.0.0.1:9008") + ("grio" . "127.0.0.1:9009"))) + (unless (get-buffer (cdr c)) + (when (or p (y-or-n-p (format "Connect to %s? " (car c)))) + (circe (car c)))))) (defun jao-all-chats () (interactive) @@ -2964,9 +3027,14 @@ (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) + (unless jao-minibuffer-mode + (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 +3322,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 () @@ -3268,20 +3337,20 @@ ("do" "open doc" jao-open-doc) ("dr" "search docs with recoll" jao-recoll-consult-docs)] ["Monitors" - ("p" "htop" jao-term-htop) + ("p" "list projects" list-projects) + ;; ("p" "htop" jao-term-htop) ("P" "pasytray" jao-toggle-pasystray-applet) ("x" "restart i3bar" jao-river-restart-i3bar :if jao-river-enabled-p) ("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)] @@ -3297,7 +3366,9 @@ ["Helpers" ("a" "aptitude" jao-term-aptitude) ("l" "packages" jao-list-packages) - ("r" "reveal" jao-reveal) + ;; ("r" "reveal" jao-reveal) + ("r" "translate" reverso) + ("f" "copy buffer file name" copy-buffer-file-name-as-kill) ("k" (lambda () (concat "keyboard" (when (jao-kb-toggled-p) "*"))) jao-kb-toggle :if jao-x11-p)]]) diff --git a/lib/doc/jao-org-notes.el b/lib/doc/jao-org-notes.el index bd82543..d3f18b8 100644 --- a/lib/doc/jao-org-notes.el +++ b/lib/doc/jao-org-notes.el @@ -1,6 +1,6 @@ ;;; jao-org-notes.el --- A simple system for org note taking -*- lexical-binding: t; -*- -;; Copyright (C) 2020, 2021, 2022, 2024 jao +;; Copyright (C) 2020, 2021, 2022, 2024, 2025 jao ;; Author: jao <mail@jao.io> ;; Keywords: tools @@ -71,14 +71,15 @@ (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)) + (consult--async-pipeline + (consult--process-collection #'jao-org-notes--rg-title-or-tags) + (consult--async-transform #'jao-org-notes--matches)) :prompt prompt - :initial (consult--async-split-initial "") - :add-history (concat (consult--async-split-initial (thing-at-point 'symbol))) + :initial (or initial "") + :add-history (thing-at-point 'symbol) :require-match (not no-req) :category 'jao-org-notes-lookup :group 'jao-org-notes--consult-group @@ -94,9 +95,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 +162,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/eos/jao-afio.el b/lib/eos/jao-afio.el index b588989..10e9115 100644 --- a/lib/eos/jao-afio.el +++ b/lib/eos/jao-afio.el @@ -1,6 +1,6 @@ ;;; jao-afio.el --- workspaces in just one frame -*- lexical-binding: t; -*- -;; Copyright (C) 2020, 2021, 2022, 2024 jao +;; Copyright (C) 2020, 2021, 2022, 2024, 2025 jao ;; Author: jao <mail@jao.io> ;; Keywords: frames @@ -228,7 +228,7 @@ (defun jao-afio-goto-scratch (&optional one-win) (interactive "P") - (jao-afio--goto-frame ?s nil) + (jao-afio--goto-frame ?s one-win) (when one-win (delete-other-windows))) (defun jao-afio-goto-chats (&optional reset) diff --git a/lib/eos/jao-dirmon.el b/lib/eos/jao-dirmon.el index 9d748d1..117da85 100644 --- a/lib/eos/jao-dirmon.el +++ b/lib/eos/jao-dirmon.el @@ -1,6 +1,6 @@ ;;; jao-dirmon.el --- little utility to monitor disk usage -*- lexical-binding: t; -*- -;; Copyright (C) 2022 jao +;; Copyright (C) 2022, 2024, 2025 jao ;; Author: jao <mail@jao.io> ;; Keywords: tools @@ -25,6 +25,7 @@ ;;; Code: (require 'multisession) +(require 'view) (require 'jao-shell) (define-multisession-variable jao-dirmon-last '()) @@ -40,9 +41,12 @@ (defvar jao-dirmon-threshold 100) (defvar jao-dirmon-last-delta nil) +(defvar jao-dirmon-buffer "*jao-dirmon") (defun jao-dirmon--show-deltas (old current deltas) - (with-temp-buffer + (with-current-buffer (get-buffer-create jao-dirmon-buffer) + (view-mode-disable) + (delete-region (point-min) (point-max)) (insert "High deltas since " (car old) "\n\n") (dolist (d (seq-sort-by #'cdr #'> deltas)) (insert (format "- %s: %s Mb\n" (car d) (cdr d)))) @@ -52,6 +56,7 @@ (seq-sort-by #'cdr #'> current))) (insert (format "- %s: %s Mb\n" (car c) (cdr c))))) (beginning-of-buffer) + (view-mode-enable) (pop-to-buffer (current-buffer) nil t) (when (y-or-n-p "Save current state?") (setf (multisession-value jao-dirmon-last) @@ -66,7 +71,7 @@ (dolist (c current) (let ((d (- (cdr c) (alist-get (car c) old 0 nil #'string=)))) (when (> (abs d) jao-dirmon-threshold) - (push c high)))) + (push (cons (car c) d) high)))) (setq jao-dirmon-last-delta high) (jao-dirmon--show-deltas old current jao-dirmon-last-delta) jao-dirmon-last-delta)) diff --git a/lib/eos/jao-minibuffer.el b/lib/eos/jao-minibuffer.el index 77bd49a..6cd5b24 100644 --- a/lib/eos/jao-minibuffer.el +++ b/lib/eos/jao-minibuffer.el @@ -1,6 +1,6 @@ ;;; jao-minibuffer.el --- using the minibuffer to report status -*- lexical-binding: t; -*- -;; Copyright (C) 2020, 2021, 2022, 2024 jao +;; Copyright (C) 2020, 2021, 2022, 2024, 2025 jao ;; Author: jao <mail@jao.io> ;; Keywords: extensions @@ -40,7 +40,7 @@ (defun jao-minibuffer--trim (s w) (if (< (string-width (or s "")) w) (format (format "%%%ds" (if jao-minibuffer-align-right w (- w))) s) - (substring s 0 w))) + (substring s 0 (min w (string-width s))))) (defun jao-minibuffer--width () (cond ((numberp jao-minibuffer-frame-width) jao-minibuffer-frame-width) @@ -97,7 +97,7 @@ info)) (sep (if msg " - " "")) (pref (when info - (let ((len (+ (length info) (length sep)))) + (let ((len (+ (string-width info) (string-width sep)))) (format (format "\n%%%ds" len) "")))) (msg (if (and msg pref) (replace-regexp-in-string "\n" pref msg) 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-mpris.el b/lib/media/jao-mpris.el index 3bb2636..80d0675 100644 --- a/lib/media/jao-mpris.el +++ b/lib/media/jao-mpris.el @@ -1,6 +1,6 @@ ;;; jao-mpris.el --- mpris players control -*- lexical-binding: t; -*- -;; Copyright (C) 2020, 2021, 2022, 2024 jao +;; Copyright (C) 2020, 2021, 2022, 2024, 2025 jao ;; Author: jao <mail@jao.io> ;; Keywords: multimedia @@ -158,25 +158,25 @@ (defun jao-mpris--handler (iname properties &rest _args) (let ((inhibit-message t)) - (message "Received properties: %S from %s" properties iname)) - (when-let (md (caadr (assoc "Metadata" properties))) - (let ((tno (caadr (assoc "xesam:trackNumber" md))) - (tlt (caadr (assoc "xesam:title" md))) - (art (caadr (assoc "xesam:artist" md))) - (alb (caadr (assoc "xesam:album" md))) - (len (caadr (assoc "mpris:length" md)))) - (if (string= (or tlt "") "TIDAL") - (jao-mpris-reset) + (message "Received properties: %S from %s" properties iname) + (when-let (md (caadr (assoc "Metadata" properties))) + (let ((tno (caadr (assoc "xesam:trackNumber" md))) + (tlt (caadr (assoc "xesam:title" md))) + (art (caadr (assoc "xesam:artist" md))) + (alb (caadr (assoc "xesam:album" md))) + (len (caadr (assoc "mpris:length" md)))) (jao-mpris--set-current 'track tno) (jao-mpris--set-current 'title tlt) (jao-mpris--set-current 'artist art) (jao-mpris--set-current 'album alb) - (jao-mpris--set-current 'length len)))) - (when-let (st (caadr (assoc "PlaybackStatus" properties))) - (jao-mpris--set-current 'status st) - (when (string= st "Stopped") - (dolist (k '(track title artist album length)) - (jao-mpris--del-current k)))) + (jao-mpris--set-current 'length len))) + (when-let (st (caadr (assoc "PlaybackStatus" properties))) + (jao-mpris--set-current 'status st) + (when (string= st "Stopped") + (dolist (k '(track title artist album length)) + (jao-mpris--del-current k)))) + ;; (message "Current is: %S" jao-mpris--current) + ) (jao-mpris--track jao-mpris--current)) ;;;###autoload 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..5cd42fa 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, 2025 jao ;; Author: jao <mail@jao.io> ;; Keywords: mail @@ -52,7 +52,7 @@ "Interactively add or remove tags to the current message." (interactive) (let* ((id (or id (jao-notmuch-gnus-message-id))) - (current (unless tags (jao-notmuch-gnus-message-tags id))) + (current (or tags (jao-notmuch-gnus-message-tags id))) (prompt (format "Change tags %s" (string-join current "/"))) (tags (or tags (notmuch-read-tag-changes current prompt)))) (notmuch-tag (concat "id:" id) tags) @@ -65,6 +65,11 @@ (when-let (id (jao-notmuch-gnus-message-id)) (message "%s" (string-join (jao-notmuch-gnus-message-tags id) " ")))) +(jao-transient-major-mode+ gnus-summary + ["Tags" + ("s" "show message tags" jao-notmuch-gnus-show-tags) + ("t" "tag message" jao-notmuch-gnus-tag-message)]) + (defun jao-notmuch-gnus-toggle-tags (tags &optional id current) "Toggle the given TAGS list for the current Gnus message." (let* ((id (or id (jao-notmuch-gnus-message-id))) @@ -76,9 +81,9 @@ (message "New tags: %s" (jao-notmuch-gnus-message-tags id)))) (defun jao-notmuch-gnus-tag-mark () - "Remove the new tag for an article when it's marked as seen by Gnus." + "Remove the new and unread tags for an article when it's marked as seen by Gnus." (when-let (id (jao-notmuch-gnus-message-id t)) - (jao-notmuch-gnus-tag-message id '("-new") t))) + (jao-notmuch-gnus-tag-message id '("-new" "-unread") t))) (add-hook 'gnus-mark-article-hook #'jao-notmuch-gnus-tag-mark) @@ -101,6 +106,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 +120,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 +219,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." @@ -221,6 +228,19 @@ Example: (consult-customize jao-gnus-consult-notmuch :preview-key 'any)) +;;; tags and flags + +(defun jao-notmuch-gnus-flag-current (&rest _) + (jao-notmuch-gnus-tag-message nil '("+flagged") t)) + +(defun jao-notmuch-gnus-unflag-current (&rest _) + (jao-notmuch-gnus-tag-message nil '("-flagged") t)) + +(advice-add 'gnus-summary-tick-article-forward + :before #'jao-notmuch-gnus-flag-current) +(advice-add 'gnus-summary-mark-as-read-forward + :before #'jao-notmuch-gnus-unflag-current) + ;;; . (provide 'jao-notmuch-gnus) ;;; jao-notmuch-gnus.el ends here diff --git a/lib/net/randomsig.el b/lib/net/randomsig.el index cb37694..05b95ab 100644 --- a/lib/net/randomsig.el +++ b/lib/net/randomsig.el @@ -1,6 +1,6 @@ ;;; randomsig.el --- insert a randomly selected signature -;; Copyright (C) 2001, 2002, 2013, 2020, 2021 Hans-Jürgen Ficker +;; Copyright (C) 2001, 2002, 2013, 2020, 2021, 2024 Hans-Jürgen Ficker ;; Emacs Lisp Archive Entry ;; Author: Hans-Juergen Ficker <hj@backmes.de> @@ -277,8 +277,11 @@ You probably want to have a newline at the end of it." (defun randomsig-prompt (&optional prompt) ;; Prompt for a signature file. (let ((files (randomsig-files-to-list randomsig-files))) - (completing-read (if prompt prompt "signature: ") - (mapcar 'list files) nil t nil randomsig-history (car files)))) + (if (cdr files) + (completing-read (if prompt prompt "signature: ") + (mapcar 'list files) nil t nil + randomsig-history (car files)) + (car files)))) (defun randomsig-read-signatures-to-buffer (buffer-name &optional files) ;; read the signatures into the signature buffer 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..f529842 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) @@ -597,7 +597,10 @@ (font-lock-type-face (p type)) (font-lock-variable-name-face (p variable-name)) (font-lock-warning-face (p warning)) + (forge-pullreq-merged (p dimm)) (forge-pullreq-open (c nil nil)) + (forge-pullreq-rejected (~ forge-pullreq-merged) st) + (forge-topic-pending (c nil nil)) (forge-topic-label bx) (fringe (p dimm)) (fuel-font-lock-debug-error (p error) nul) |