diff options
Diffstat (limited to 'custom')
-rw-r--r-- | custom/jao-custom-completion.el | 2 | ||||
-rw-r--r-- | custom/jao-custom-eww.el | 28 | ||||
-rw-r--r-- | custom/jao-custom-exwm.el | 2 | ||||
-rw-r--r-- | custom/jao-custom-gnus.el | 81 | ||||
-rw-r--r-- | custom/jao-custom-notmuch.el | 13 | ||||
-rw-r--r-- | custom/jao-custom-org.el | 6 |
6 files changed, 95 insertions, 37 deletions
diff --git a/custom/jao-custom-completion.el b/custom/jao-custom-completion.el index b44f9b6..9524e23 100644 --- a/custom/jao-custom-completion.el +++ b/custom/jao-custom-completion.el @@ -107,7 +107,7 @@ :ensure t :bind (("C-x M-:" . consult-complex-command) ("C-x b" . consult-buffer) - ("C-x C-b" . consult-buffer) + ("C-x C-b" . switch-to-buffer) ("C-x 4 b" . consult-buffer-other-window) ("C-c b" . project-find-file) ("C-c h" . nil) 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-exwm.el b/custom/jao-custom-exwm.el index dbad1da..e5c67f8 100644 --- a/custom/jao-custom-exwm.el +++ b/custom/jao-custom-exwm.el @@ -151,7 +151,7 @@ (add-hook 'exwm-workspace-switch-hook #'jao-minibuffer-refresh) (require 'exwm-systemtray) -(exwm-systemtray-enable) +(exwm-systemtray-mode 1) (defun jao-exwm--watch-tray (sym newval op where) (setq jao-minibuffer-right-margin (* 2 (length newval))) diff --git a/custom/jao-custom-gnus.el b/custom/jao-custom-gnus.el index e5a1762..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 @@ -590,9 +636,9 @@ ("nnml:bigml\\.bugs" "b" jao-themes-error) ("nnml:bigml\\.support" "S" default) ("nnml:jao\\.\\(inbox\\|trove\\)" "I" jao-themes-f01) - ("nnml:bigml\\.[^ibs]" "W" jao-themes-dimm) + ("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/custom/jao-custom-org.el b/custom/jao-custom-org.el index 02e7a03..4d2e622 100644 --- a/custom/jao-custom-org.el +++ b/custom/jao-custom-org.el @@ -167,9 +167,9 @@ '("pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f" "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f")) -(use-package ox-pandoc - :after org - :ensure t) +;; (use-package ox-pandoc +;; :after org +;; :ensure t) ;;; Babel and literate programming (setq org-src-window-setup 'other-window) ;; current-window |