diff options
Diffstat (limited to 'custom')
-rw-r--r-- | custom/jao-custom-eww.el | 19 | ||||
-rw-r--r-- | custom/jao-custom-gnus.el | 193 |
2 files changed, 93 insertions, 119 deletions
diff --git a/custom/jao-custom-eww.el b/custom/jao-custom-eww.el index 0409fc5..a3f4df9 100644 --- a/custom/jao-custom-eww.el +++ b/custom/jao-custom-eww.el @@ -201,10 +201,11 @@ It should be the title of the web page as returned by `rdrview'" (eww-header-line-format " %u") (eww-form-checkbox-selected-symbol "☒") (eww-buffer-name-length 180) - (eww-readable-urls '("guardian\\.co\\.uk" - "theguardian\\.com" - "eldiario\\.es" - "theconversation"))) + ;; (eww-readable-urls '("guardian\\.co\\.uk" + ;; "theguardian\\.com" + ;; "eldiario\\.es" + ;; "theconversation")) + ) :config (with-eval-after-load "org" (require 'ol-eww nil t)) @@ -245,6 +246,16 @@ 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) diff --git a/custom/jao-custom-gnus.el b/custom/jao-custom-gnus.el index 68cf0a5..e5a1762 100644 --- a/custom/jao-custom-gnus.el +++ b/custom/jao-custom-gnus.el @@ -1,6 +1,6 @@ ;; gnus configuration -*- lexical-binding: t -*- -;;; Feature switching vars +;;; features (defvar jao-gnus-use-local-imap nil) (defvar jao-gnus-use-leafnode nil) (defvar jao-gnus-use-gandi-imap nil) @@ -9,15 +9,9 @@ (defvar jao-gnus-use-nnml nil) (defvar jao-gnus-use-maildirs nil) (defvar jao-notmuch-enabled nil) +(defvar jao-gnus-nnml-group-params nil) -;;; Startup and kill -(setq gnus-interactive-exit t) - -(defun jao-quit-gnus () (gnus-group-exit) t) - -(add-hook 'kill-emacs-query-functions #'jao-quit-gnus) - -;;; Directories +;;; directories (defun jao-gnus-dir (dir) (expand-file-name dir gnus-home-directory)) @@ -36,10 +30,9 @@ nndraft-directory (jao-gnus-dir "drafts") nnrss-directory (jao-gnus-dir "rss")) -;;; Verbosity +;;; looks +;;;; verbosity (setq gnus-verbose 4) - -;;; Looks ;;;; geometry (defvar jao-gnus-use-three-panes t) (defvar jao-gnus-groups-width 50) @@ -54,10 +47,12 @@ ;; (dolist (m '(calendar-mode org-agenda-mode gnus-group-mode)) ;; (add-to-list 'display-buffer-alist `((major-mode . ,m) (dedicated t)))) + (setq calendar-left-margin 6) + (let ((side-bar '(vertical 1.0 ("inbox.org" 0.4) ("*Org Agenda*" 1.0) - ("*Calendar*" 9))) + ("*Calendar*" 8))) (wide-len jao-gnus-wide-width) (groups-len jao-gnus-groups-width) (summary-len (- jao-gnus-wide-width jao-gnus-groups-width))) @@ -97,7 +92,7 @@ (advice-add 'gnus-mode-line-buffer-identification :override #'identity) (setq gnus-mode-line-image-cache nil) -;;; Search +;;; search (setq gnus-search-use-parsed-queries nil gnus-search-notmuch-raw-queries-p nil gnus-permanently-visible-groups "^nnselect:.*" @@ -139,7 +134,7 @@ ;; (add-to-list 'gnus-parameters '("^nnselect:.*" (nnselect-rescan . t))) -;;; News server +;;; news (defvar jao-gnus-leafnode-spool "/var/spool/news/") (setq gnus-select-method (cond @@ -171,7 +166,7 @@ (dolist (p jao-gnus-leafnode-group-params) (add-to-list 'gnus-parameters p t))) -;;; Mail +;;; mail ;;;; nnmail (setq nnmail-treat-duplicates 'delete nnmail-scan-directory-mail-source-once nil @@ -210,71 +205,6 @@ `(nnml "" (gnus-search-engine gnus-search-recoll (remove-prefix ,(jao-gnus-dir "Mail/")))))) -(defvar jao-gnus-nnml-group-params - `(("nnml:\\(local\\|trash\\|spam\\)" - (auto-expire . t) - (total-expire . t) - (expiry-wait . 1) - (expiry-target . delete)) - ("nnml:jao\\..*" - (posting-style ("Gcc" "nnml:jao.trove")) ;; ("Bcc" "proton@jao.io") - (jao-gnus--trash-group "nnml:trash") - (jao-gnus--spam-group "nnml:spam") - (jao-gnus--archiving-group "nnml:jao.trove") - (gcc-self . t)) - ("nnml:jao\\.hacking" - (posting-style ("Gcc" "nnml:jao.hacking") - (address "jao@gnu.org"))) ;; ("Bcc" "hacking@jao.io") - ("nnml:jao\\.drivel" - (auto-expire . t) - (total-expire . t) - (expiry-wait . 3) - (expiry-target . delete)) - ("nnml:bigml\\..*" - (gcc-self . nil) - (auto-expire . t) - (total-expire . t) - (expiry-wait . 3) - (expiry-target . delete) - (posting-style (address "jao@bigml.com")) - (jao-gnus--trash-group "nnml:trash") - (jao-gnus--spam-group "nnml:spam") - (jao-gnus--archiving-group "nnml:bigml.trove")) - ("nnml:bigml\\.inbox" - (gcc-self . t) - (auto-expire . t) - (total-expire . t) - (expiry-wait . 7) - (expiry-target . "nnml:bigml.trove")) - ("nnml:bigml\\.alba" - (gcc-self . t) - (auto-expire . nil) - (total-expire . nil) - (expiry-target . nil) - (expiry-wait . nil)) - ("nnml:bigml\\.trove" - (auto-expire . t) - (total-expire . t) - (expiry-target . delete) - (expiry-wait . 365)) - ("nnml:feeds\\.\\(.*\\)" - (posting-style ("Gcc" "nnml:feeds.trove") - (address "jao@gnu.org")) - (auto-expire . t) - (total-expire . t) - (expiry-wait . 7) - (expiry-target . delete) - (comment . "feeds.\\1") - (jao-gnus--archiving-group "nnml:feeds.trove")) - ("nnml:feeds\\.\\(news\\|emacs-\\(bugs\\|diffs|\\github\\)\\)$" - (expiry-wait . 2)) - ("nnml:feeds\\.trove" - (auto-expire . nil) - (total-expire . nil)) - ("nnml:feeds\\.fun" - (mm-html-inhibit-images nil) - (mm-html-blocked-images nil)))) - (when jao-gnus-use-nnml (dolist (p jao-gnus-nnml-group-params) (add-to-list 'gnus-parameters p t))) @@ -297,7 +227,7 @@ (add-to-list 'gnus-secondary-select-methods '(nnimap "gandi" (nnimap-address "mail.gandi.net")))) -;;; Groups +;;; groups (setq gnus-group-line-format " %m%S%p%3y%P%* %~(pad-right 30)G %B\n" ;; " %m%S%p%P:%~(pad-right 35)c %3y %B\n" @@ -310,7 +240,26 @@ (add-hook 'gnus-select-group-hook 'gnus-group-set-timestamp) (add-hook 'gnus-group-mode-hook 'gnus-topic-mode) -;;; Summary +;;; rss +(setq nnrss-use-local t ;; M-x nnrss-generate-download-script + nnrss-ignore-article-fields '(category + dc:creator + dc:date + enclosure + guid + link + media:content + media:thumbnail + media:title + post-id + pubDate + slash:comments)) + +(add-to-list 'gnus-parameters `(,(format "nnrss:%s.*" + (regexp-opt jao-gnus-image-groups t)) + (mm-html-inhibit-images nil) + (mm-html-blocked-images nil))) +;;; summary ;;;; configuration (setq gnus-summary-ignore-duplicates t gnus-suppress-duplicates t @@ -328,8 +277,7 @@ gnus-summary-gather-subject-limit nil ;; 120 gnus-summary-thread-gathering-function #'gnus-gather-threads-by-subject gnus-sort-gathered-threads-function 'gnus-thread-sort-by-date - - gnus-thread-sort-functions '(gnus-thread-sort-by-number)) + gnus-thread-sort-functions '(gnus-thread-sort-by-date)) (defun jao-fix-protonmail-references (header) (let ((references (mail-header-references header))) @@ -504,7 +452,7 @@ (goto-char (point-max)) (org-capture nil "X")) -;;; Article +;;; article ;;;; config, headers (setq mail-source-delete-incoming t) (setq gnus-gcc-mark-as-read t) @@ -561,8 +509,8 @@ (gnus-article-remove-images))))) (jao-gnus-browse-html))) -;;;; remove html in From: -(require 'shr) +;;;; format from: + (defvar jao-gnus--from-rx (concat "From: \\\"?\\( *" jao-gnus--news-rx "\\)")) @@ -609,7 +557,28 @@ (eval-after-load "message" '(setq message-draft-headers (remove 'Date message-draft-headers))) -;;; Add-ons +;;; daemon and exit +(setq gnus-interactive-exit t) +(defun jao-quit-gnus () (gnus-group-exit) t) +(add-hook 'kill-emacs-query-functions #'jao-quit-gnus) + +;; daemon config +(setq mail-user-agent 'gnus-user-agent) +(setq gnus-asynchronous t) +(setq gnus-use-article-prefetch nil) +(setq gnus-save-killed-list nil) +(setq gnus-check-new-newsgroups nil) + +(require 'gnus-demon) + +(defun jao-gnus--scan () + (let ((inhibit-message t)) + (gnus-demon-scan-news) + (jao-gnus--notify))) + +(gnus-demon-add-handler 'jao-gnus--scan 5 1) + +;;; add-ons ;;;; notifications ;;;;; minibuffer (defvar jao-gnus-tracked-groups @@ -623,18 +592,18 @@ ("nnml:jao\\.\\(inbox\\|trove\\)" "I" jao-themes-f01) ("nnml:bigml\\.[^ibs]" "W" jao-themes-dimm) ("nnml:jao.hacking" "H" jao-themes-dimm) - ("nnml:jao.[^isth]" "J" jao-themes-dimm) + ("nnml:jao.write" "W" jao-themes-error) + ("nnml:jao.[^isthw]" "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)))) + ("nnml:local" "l" jao-themes-dimm) + ("nnrss:.*" "R" jao-themes-dimm) + ("^\\(gwene\\|gmane\\)\\." "N" jao-themes-dimm)))) (defun jao-gnus--unread-counts () (seq-reduce (lambda (r g) (let ((n (gnus-group-unread (car g)))) - (if (and (numberp n) (> n 0)) - (prog1 (cons (cons (car g) n) r) - (gnus-message 7 "%s in %s" n g)) - r))) + (if (and (numberp n) (> n 0)) (cons (cons (car g) n) r) r))) gnus-newsrc-alist ())) @@ -662,28 +631,18 @@ (jao-minibuffer-add-variable 'jao-gnus--notify-strs -20)) (add-hook 'gnus-started-hook #'jao-gnus--notify) -(add-hook 'gnus-summary-exit-hook #'jao-gnus--notify) +;; (add-hook 'gnus-summary-exit-hook #'jao-gnus--notify) (add-hook 'gnus-after-getting-new-news-hook #'jao-gnus--notify) -;;;;; daemon config -(setq mail-user-agent 'gnus-user-agent) -(setq gnus-asynchronous t) -(setq gnus-use-article-prefetch nil) -(setq gnus-save-killed-list nil) -(setq gnus-check-new-newsgroups nil) - -(require 'gnus-demon) - -(defun jao-gnus--scan () - (let ((inhibit-message t)) - (gnus-demon-scan-news) +;;;;; agenda and other updates on summary exit +(let ((exit-count 0)) + (defun jao-gnus--on-summary-exit () + (when (> (setq exit-count (+ 1 exit-count)) 20) + (setq exit-count 0) + (jao-org-agenda)) (jao-gnus--notify))) -(gnus-demon-add-handler 'jao-gnus--scan 5 1) - -;;;;; agenda updates -(add-hook 'gnus-summary-exit-hook #'jao-org-agenda) - +(add-hook 'gnus-summary-exit-hook #'jao-gnus--on-summary-exit) ;;;; open mail file in gnus (defun jao-gnus-file-to-group (file &optional maildir newsdir m-server n-server) @@ -725,6 +684,10 @@ (add-hook 'jao-afio-switch-hook #'jao-gnus--on-afio-switch) +(defun jao-gnus-refresh-workspace () + (interactive) + (save-window-excursion (calendar) (jao-org-agenda))) + ;;;; gnus-icalendar (require 'ol-gnus) (use-package gnus-icalendar @@ -754,7 +717,7 @@ (with-eval-after-load "consult-recoll" (add-to-list 'consult-recoll-open-fns '("message/rfc822" . jao-gnus-goto-file)))) -;;; Keyboard shortcuts +;;; keyboard shortcuts (define-key gnus-article-mode-map "i" 'jao-gnus-show-images) (define-key gnus-summary-mode-map "i" 'jao-gnus-show-images) (define-key gnus-article-mode-map "\M-g" 'jao-gnus-follow-link) @@ -764,4 +727,4 @@ (define-key gnus-summary-mode-map "X" 'jao-gnus-arXiv-capture) (define-key gnus-summary-mode-map "e" 'jao-gnus-open-enclosure) (define-key gnus-summary-mode-map "\C-l" nil) -(define-key gnus-group-mode-map (kbd "A") 'nil) +(define-key gnus-group-mode-map "a" 'jao-gnus-refresh-workspace) |