summaryrefslogtreecommitdiffhomepage
path: root/custom
diff options
context:
space:
mode:
Diffstat (limited to 'custom')
-rw-r--r--custom/jao-custom-browse.el66
-rw-r--r--custom/jao-custom-completion.el4
-rw-r--r--custom/jao-custom-email.el2
-rw-r--r--custom/jao-custom-eww.el17
-rw-r--r--custom/jao-custom-gnus.el114
-rw-r--r--custom/jao-custom-notmuch.el7
-rw-r--r--custom/jao-custom-org.el3
-rw-r--r--custom/jao-custom-pdf.el2
-rw-r--r--custom/jao-custom-programming.el45
-rw-r--r--custom/jao-custom-w3m.el2
10 files changed, 126 insertions, 136 deletions
diff --git a/custom/jao-custom-browse.el b/custom/jao-custom-browse.el
index 2787518..ec5a000 100644
--- a/custom/jao-custom-browse.el
+++ b/custom/jao-custom-browse.el
@@ -1,5 +1,8 @@
;; -*- lexical-binding: t -*-
+;;; Deps
+(require 'jao-url)
+
;;; Browsing
;;;; variables
(defvar jao-browse-doc-use-emacs-p (jao-is-linux))
@@ -7,14 +10,6 @@
(defvar jao-browse-url-external-function nil)
;;;; url around point
-(defun jao-url-around-point (&optional current-url)
- (or (and (fboundp 'w3m-anchor) (w3m-anchor))
- (shr-url-at-point nil)
- (ffap-url-at-point)
- (thing-at-point 'url)
- (when current-url
- (or (and (fboundp 'w3m-anchor) (w3m-anchor))
- (and (derived-mode-p 'eww-mode) (plist-get eww-data :url))))))
(defun jao--url-prompt (&optional prefix)
(let* ((def (jao-url-around-point t))
@@ -108,7 +103,7 @@
;;;; browse-url
(require 'browse-url)
-(setq browse-url-generic-program "firefox")
+(setq browse-url-generic-program (jao-d-l "open" "firefox"))
(defun jao-browse-with-external-browser (&rest url)
"Browse with external hogging"
@@ -191,59 +186,6 @@
(,(jao-wget--regexp) . jao-download)
("." . jao-browse-url-browse))))
-;;;; subscribe to rss using r2e
-(autoload 'View-quit "view")
-
-(defun jao-rss--find-url ()
- (save-excursion
- (when (derived-mode-p 'w3m-mode 'eww-mode)
- (if (fboundp 'w3m-view-source) (w3m-view-source) (eww-view-source)))
- (goto-char (point-min))
- (when (re-search-forward
- "type=\"application/\\(?:atom\\|rss\\)\\+xml\" +" nil t)
- (let ((url (save-excursion
- (when (re-search-forward
- "href=\"\\([^\n\"]+\\)\"" nil t)
- (match-string-no-properties 1))))
- (title (when (re-search-forward
- "\\(?:title=\"\\([^\n\"]+\\)\" +\\)" nil t)
- (match-string-no-properties 1))))
- (cond ((derived-mode-p 'w3m-view-mode) (w3m-view-source))
- ((string-match-p ".*\\*eww-source\\b.*" (buffer-name))
- (View-quit)))
- (when url (cons url (or title "")))))))
-
-(defun jao-rss2e-append (name url mbox)
- (with-current-buffer (find-file-noselect "~/.config/rss2email.cfg")
- (goto-char (point-max))
- (insert "[feed." name "]\nurl = " url)
- (insert "\nto = " mbox "+" name "@localhost")
- (insert "\nmaildir-mailbox = " mbox "\n\n")
- (save-buffer)))
-
-(defun jao-rss--feeds-dirs ()
- (mapcar (lambda (d) (cadr (split-string d "\\.")))
- (directory-files "~/.emacs.d/gnus/Mail/" nil "^feeds")))
-
-(defun jao-rss-subscribe (url)
- "Subscribe to a given RSS URL. If URL not given, look for it."
- (interactive (list (or (jao-url-around-point)
- (jao-rss--find-url)
- (read-string "Feed URL: "))))
- (let* ((url+title (ensure-list url))
- (url (car url+title))
- (title (cdr url+title)))
- (unless url (error "No feeds found"))
- (let ((url (if (string-match "^feed:" url) (substring url 5) url)))
- (when (y-or-n-p (format "Subscribe to <%s>? " url))
- (let* ((name (read-string "Feed name: " title))
- (cats (cons "prog" (jao-notmuch--subtags "feeds")))
- (cat (completing-read "Category: " cats nil t))
- (subs (format "r2e add %s '%s' feeds.%s@localhost"
- name url cat)))
- ;; (jao-rss2e-append name url cat)
- (shell-command-to-string subs)
- (shell-command (format "r2e run %s" name)))))))
(provide 'jao-custom-browse)
;;; jao-custom-browse.el ends here
diff --git a/custom/jao-custom-completion.el b/custom/jao-custom-completion.el
index 436a4db..98b853c 100644
--- a/custom/jao-custom-completion.el
+++ b/custom/jao-custom-completion.el
@@ -1,5 +1,7 @@
;; -*- lexical-binding: t; -*-
+(require 'jao-r2e)
+
;;; builtin completion
(setq tab-always-indent 'complete
read-extended-command-predicate #'command-completion-default-include-p
@@ -308,7 +310,7 @@
(define-key embark-url-map (kbd "RET") #'jao-embark-url)
(define-key embark-url-map (kbd "f") #'browse-url-firefox)
-(define-key embark-url-map (kbd "x") #'jao-rss-subscribe)
+(define-key embark-url-map (kbd "x") #'jao-r2e-subscribe)
(define-key embark-url-map (kbd "m") 'jao-browse-with-external-browser)
(define-key embark-url-map (kbd "p") 'jao-mpc-add-or-play-url)
diff --git a/custom/jao-custom-email.el b/custom/jao-custom-email.el
index 534b342..b9e4ba9 100644
--- a/custom/jao-custom-email.el
+++ b/custom/jao-custom-email.el
@@ -11,7 +11,7 @@
(defvar jao-mails)
(defvar jao-extra-mails nil)
(defvar jao-mails-regexp (regexp-opt jao-mails))
-
+(defvar jao-maildir (jao-d-l "~/Documents/mail" "~/var/mail"))
;;; gnus
(setq gnus-init-file "~/.emacs.d/gnus.el"
gnus-home-directory "~/.emacs.d/gnus"
diff --git a/custom/jao-custom-eww.el b/custom/jao-custom-eww.el
index cdd5c8d..beeb97e 100644
--- a/custom/jao-custom-eww.el
+++ b/custom/jao-custom-eww.el
@@ -1,5 +1,7 @@
;; -*- lexical-binding: t -*-
+(require 'jao-r2e)
+
;;; integration with browse-url and afio
(defun jao-eww-browse-url (url &rest _r)
"Browse URL using eww."
@@ -159,7 +161,10 @@
;;; auto-readable
(defvar jao-eww-auto-readable-urls
- (regexp-opt '("guardian.co.uk" "theguardian.com" "github.com" "eldiario.es")))
+ (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)))
@@ -195,12 +200,6 @@
(when (not (string-blank-p s)) (format "%s" s))))
(setq eww-auto-rename-buffer #'jao-eww-buffer-name)
- (defun jao-eww-readable (rdrview)
- (interactive "P" eww-mode)
- (if rdrview
- (eww-rdrview-toggle-and-reload)
- (eww-readable)))
-
:bind (:map eww-mode-map (("b" . eww-back-url)
("B" . eww-forward-url)
("d" . jao-download)
@@ -211,7 +210,7 @@
("o" . jao-eww-browse)
("O" . jao-eww-browse-new)
("r" . jao-eww-reload)
- ("R" . jao-eww-readable)
+ ("R" . eww-readable)
("s" . eww-search-words)
("S" . jao-eww-browse-new)
("T" . jao-mastodon-toot-url)
@@ -219,7 +218,7 @@
("U" . jao-eww-reopen-new)
("w" . jao-eww-to-org)
("q" . jao-eww-close)
- ("x" . jao-rss-subscribe)
+ ("x" . jao-r2e-subscribe)
("y" . jao-eww-copy-link)
("\\" . eww-view-source)
("C-c C-w" . jao-eww-close)
diff --git a/custom/jao-custom-gnus.el b/custom/jao-custom-gnus.el
index 3165372..ec6c761 100644
--- a/custom/jao-custom-gnus.el
+++ b/custom/jao-custom-gnus.el
@@ -30,11 +30,13 @@
nndraft-directory (jao-gnus-dir "drafts")
nnrss-directory (jao-gnus-dir "rss"))
+(setq gnus-uncacheable-groups "^nnml")
+
;;; looks
;;;; verbosity
(setq gnus-verbose 4)
;;;; geometry
-(defvar jao-gnus-use-three-panes t)
+(defvar jao-gnus-use-three-panes (not jao-notmuch-enabled))
(defvar jao-gnus-groups-width 50)
(defvar jao-gnus-wide-width 190)
@@ -44,37 +46,76 @@
(setq calendar-left-margin 6)
-(let ((wide-len jao-gnus-wide-width)
- (groups-len jao-gnus-groups-width)
- (summary-len (- jao-gnus-wide-width jao-gnus-groups-width)))
- (gnus-add-configuration
- `(article
- (horizontal 1.0
- (vertical ,groups-len (group 1.0))
- (vertical 1.0
- (summary 0.25 point)
- (article 1.0)))))
-
- ;; (gnus-add-configuration
- ;; `(group (horizontal 1.0 (group ,wide-len point))))
-
- (gnus-add-configuration
- `(message (horizontal 1.0 (message ,wide-len point))))
-
- (gnus-add-configuration
- `(reply-yank (horizontal 1.0 (message ,wide-len point))))
-
- (gnus-add-configuration
- `(summary
- (horizontal 1.0
- (vertical ,groups-len (group 1.0))
- (vertical 1.0 (summary 1.0 point)))))
-
- (gnus-add-configuration
- `(reply
- (horizontal 1.0
- (message ,(- wide-len 100) point)
- (article 100)))))
+(if jao-gnus-use-three-panes
+ (let ((side-bar '(vertical 1.0
+ ("inbox.org" 0.4)
+ ("*Org Agenda*" 1.0)
+ ("*Calendar*" 8)))
+ (wide-len jao-gnus-wide-width)
+ (groups-len jao-gnus-groups-width)
+ (summary-len (- jao-gnus-wide-width jao-gnus-groups-width)))
+ (gnus-add-configuration
+ `(article
+ (horizontal 1.0
+ (vertical ,groups-len (group 1.0))
+ (vertical ,summary-len
+ (summary 0.25 point)
+ (article 1.0))
+ ,side-bar)))
+
+ (gnus-add-configuration
+ `(group (horizontal 1.0 (group ,wide-len point) ,side-bar)))
+
+ (gnus-add-configuration
+ `(message (horizontal 1.0 (message ,wide-len point) ,side-bar)))
+
+ (gnus-add-configuration
+ `(reply-yank (horizontal 1.0 (message ,wide-len point) ,side-bar)))
+
+ (gnus-add-configuration
+ `(summary
+ (horizontal 1.0
+ (vertical ,groups-len (group 1.0))
+ (vertical ,summary-len (summary 1.0 point))
+ ,side-bar)))
+
+ (gnus-add-configuration
+ `(reply
+ (horizontal 1.0
+ (message ,(- wide-len 100) point)
+ (article 100)
+ ,side-bar))))
+ (let ((wide-len jao-gnus-wide-width)
+ (groups-len jao-gnus-groups-width)
+ (summary-len (- jao-gnus-wide-width jao-gnus-groups-width)))
+ (gnus-add-configuration
+ `(article
+ (horizontal 1.0
+ (vertical ,groups-len (group 1.0))
+ (vertical 1.0
+ (summary 0.25 point)
+ (article 1.0)))))
+
+ ;; (gnus-add-configuration
+ ;; `(group (horizontal 1.0 (group ,wide-len point))))
+
+ (gnus-add-configuration
+ `(message (horizontal 1.0 (message ,wide-len point))))
+
+ (gnus-add-configuration
+ `(reply-yank (horizontal 1.0 (message ,wide-len point))))
+
+ (gnus-add-configuration
+ `(summary
+ (horizontal 1.0
+ (vertical ,groups-len (group 1.0))
+ (vertical 1.0 (summary 1.0 point)))))
+
+ (gnus-add-configuration
+ `(reply
+ (horizontal 1.0
+ (message ,(- wide-len 100) point)
+ (article 100))))))
;;;; no blue icon
(advice-add 'gnus-mode-line-buffer-identification :override #'identity)
@@ -185,7 +226,7 @@
(setq mail-sources
(let* ((pwd (auth-source-pick-first-password :host "proton-bridge"))
(mds (mapcar (lambda (f)
- `(maildir :path ,(expand-file-name f "~/var/mail/")))
+ `(maildir :path ,(expand-file-name f jao-maildir)))
'("local/" "feeds/")))
(ims (mapcar (lambda (b)
`(imap :server "127.0.0.1" :port 1143
@@ -308,12 +349,13 @@
"\n"))
(defun jao-gnus--set-summary-line (&optional w)
- (let* ((d (if jao-gnus-use-three-panes (+ jao-gnus-groups-width 11) 12))
+ (let* ((d (if jao-gnus-use-three-panes
+ (+ jao-gnus-groups-width 11)
+ (+ jao-gnus-groups-width 12)))
(w (- (or w (window-width)) d)))
(setq gnus-summary-line-format (format jao-gnus--summary-line-fmt w))))
-;; (add-hook 'gnus-select-group-hook 'jao-gnus--set-summary-line)
-;; (jao-gnus--set-summary-line 150)
+(add-hook 'gnus-select-group-hook 'jao-gnus--set-summary-line)
(add-to-list 'nnmail-extra-headers 'Cc)
(add-to-list 'nnmail-extra-headers 'BCc)
diff --git a/custom/jao-custom-notmuch.el b/custom/jao-custom-notmuch.el
index 30b0976..a0dba56 100644
--- a/custom/jao-custom-notmuch.el
+++ b/custom/jao-custom-notmuch.el
@@ -185,11 +185,6 @@
'("new" "unread" "flagged" "signed" "sent" "attachment" "forwarded" "inbox"
"encrypted" "gmane" "gnus" "feeds" "rss" "mce" "trove" "prog" "emacs"))
-(defun jao-notmuch--subtags (tag &rest excl)
- (let* ((cmd (concat "notmuch search --output=tags tag:" tag))
- (ts (split-string (shell-command-to-string cmd))))
- (seq-difference ts (append jao-notmuch--shared-tags (cons tag excl)))))
-
(setq notmuch-archive-tags '("+trove" "-new" "-drivel" "-words" "-inbox")
notmuch-show-mark-read-tags '("-new" "-unread")
notmuch-tag-formats
@@ -245,7 +240,7 @@
(when jao-notmuch-enabled
(define-key message-mode-map (kbd "C-c C-d") #'notmuch-draft-postpone)
- (setq message-directory "~/var/mail/"
+ (setq message-directory (file-name-as-directory jao-maildir)
message-auto-save-directory "/tmp"
mail-user-agent 'message-user-agent))
diff --git a/custom/jao-custom-org.el b/custom/jao-custom-org.el
index cd4ec25..f4e84a8 100644
--- a/custom/jao-custom-org.el
+++ b/custom/jao-custom-org.el
@@ -30,6 +30,9 @@
org-modules '(bibtex info eww eshell git-link)
org-odd-levels-only t
org-outline-path-complete-in-steps nil
+ org-persist-directory (jao-d-l
+ "~/Tmp/org-persist"
+ "/tmp/org-persist")
org-refile-allow-creating-parent-nodes 'confirm
org-refile-targets '((nil :maxlevel . 5)
(org-agenda-files :maxlevel . 5))
diff --git a/custom/jao-custom-pdf.el b/custom/jao-custom-pdf.el
index 4ebd7f1..5e2c27d 100644
--- a/custom/jao-custom-pdf.el
+++ b/custom/jao-custom-pdf.el
@@ -78,6 +78,7 @@
;;;; doc-view
(use-package doc-view
+ :if (jao-is-linux)
:init
(setq doc-view-cache-directory "~/.emacs.d/cache/docview"
doc-view-resolution 110
@@ -95,6 +96,7 @@
(use-package jao-doc-session :demand t)
(use-package jao-doc-view
+ :if (jao-is-linux)
:demand t
:bind (:map doc-view-mode-map
("b" . jao-doc-view-back)
diff --git a/custom/jao-custom-programming.el b/custom/jao-custom-programming.el
index 4028f3d..b88c43c 100644
--- a/custom/jao-custom-programming.el
+++ b/custom/jao-custom-programming.el
@@ -239,32 +239,37 @@
;;;; Clojure
(use-package clojure-mode
:ensure t
+ :hook (clojure-mode . jao-clojure--fix-things)
:config
(defun jao-clojure--fix-things ()
(setq-local completion-styles '(basic partial-completion emacs22))
(eldoc-mode 1)
(setq mode-name "λ"))
- :hook (clojure-mode . jao-clojure--fix-things))
-(defun jao-cider-test-ns (ns)
- (let ((parts (string-split ns "\\.")))
- (if (string= "test" (cadr parts))
- ns
- (mapconcat #'identity (cons (car parts) (cons "test" (cdr parts))) "."))))
-
-(defun jao-kaocha-file-name ()
- (let* ((filename (match-string 2))
- (path (replace-regexp-in-string "\\." "/" (match-string 1))))
- (substring-no-properties (concat "test/" path filename))))
-
-(defconst jao-kaocha-compilation-error
- '(kaocha-error "^FAIL in \\(.+\\.\\)[^ ]+ (\\([^:]+\\.clj[cs]?\\):\\([0-9]+\\))"
- jao-kaocha-file-name 3))
-
-(use-package compile
- :config
- (add-to-list 'compilation-error-regexp-alist-alist
- jao-kaocha-compilation-error))
+ (defun jao-cider-test-ns (ns)
+ (let ((parts (string-split ns "\\.")))
+ (if (string= "test" (cadr parts))
+ ns
+ (mapconcat #'identity
+ (cons (car parts) (cons "test" (cdr parts))) "."))))
+
+ (defun jao-kaocha-file-name ()
+ (let* ((filename (match-string 2))
+ (path (replace-regexp-in-string "\\." "/" (match-string 1))))
+ (substring-no-properties (concat "test/" path filename))))
+
+ (defconst jao-kaocha-compilation-error
+ '(kaocha-error
+ "^FAIL in \\(.+\\.\\)[^ ]+ (\\([^:]+\\.clj[cs]?\\):\\([0-9]+\\))"
+ jao-kaocha-file-name 3))
+
+ (use-package compile
+ :config
+ (add-to-list 'compilation-error-regexp-alist-alist
+ jao-kaocha-compilation-error)))
+
+(use-package jao-clojure
+ :bind (:map clojure-mode-map (("C-c o" . jao-clojure-other-file))))
(use-package cider
:ensure t
diff --git a/custom/jao-custom-w3m.el b/custom/jao-custom-w3m.el
index 43b9e2d..f532e8b 100644
--- a/custom/jao-custom-w3m.el
+++ b/custom/jao-custom-w3m.el
@@ -198,7 +198,7 @@
("v" . jao-view-video)
("q" . w3m-delete-buffer)
("w" . org-w3m-copy-for-org-mode)
- ("x" . jao-rss-subscribe)
+ ("x" . jao-r2e-subscribe)
("y" . w3m-print-current-url))))
;;; textsec