1.1--- a/.emacs.d/ellis.el Fri Aug 30 17:07:30 2024 -0400
1.2+++ b/.emacs.d/ellis.el Sat Sep 07 22:40:44 2024 -0400
1.3@@ -112,12 +112,12 @@
1.4 notmuch-show-logo nil
1.5 notmuch-search-oldest-first nil
1.6 notmuch-hello-hide-tags '("kill")
1.7- notmuch-saved-searches '((:name "inbox" :query "tag:inbox" :key "i")
1.8- (:name "unread" :query "tag:unread" :key "u")
1.9+ notmuch-saved-searches '((:name "unread" :query "tag:unread" :key "u")
1.10+ (:name "inbox" :query "tag:inbox" :key "i")
1.11 (:name "new" :query "tag:new" :key "n")
1.12+ (:name "drafts" :query "tag:draft" :key "d")
1.13 (:name "sent" :query "tag:sent" :key "e")
1.14- (:name "drafts" :query "tag:draft" :key "d")
1.15- (:name "all mail" :query "*" :key "a")
1.16+ (:name "all" :query "*" :key "a")
1.17 (:name "todo" :query "tag:todo" :key "t")))
1.18 :config
1.19 ;;;###autoload
1.20@@ -187,8 +187,6 @@
1.21 ("http://arxiv.org/rss/econ" econ rnd)
1.22 ;; John Wiegley
1.23 ("http://newartisans.com/rss.xml" dev blog)
1.24- ;; comp
1.25- ;; ("https://lab.rwest.io/comp.atom?feed_token=pHu9qwLkjy4CWJHx9rrJ" comp vc)
1.26 ("https://www.reddit.com/r/listentothis/.rss" music reddit)
1.27 ("https://www.ftc.gov/feeds/press-release-consumer-protection.xml" gov ftc)
1.28 ("https://api2.fcc.gov/edocs/public/api/v1/rss/" gov fcc)
1.29@@ -269,10 +267,11 @@
1.30 (setq
1.31 org-timeline-insert-before-text "›"
1.32 org-timeline-beginning-of-day-hour 8
1.33+ org-timeline-default-duration 30
1.34 org-timeline-keep-elapsed 2
1.35- org-timeline-start-hour 5
1.36+ org-timeline-start-hour 8
1.37 org-timeline-show-text-in-blocks t
1.38- org-timeline-prepend t))
1.39+ org-timeline-prepend nil))
1.40
1.41 ;;; IRC
1.42 (setq erc-format-nick-function 'erc-format-@nick)
1.43@@ -339,7 +338,7 @@
1.44 (while (< (point) end)
1.45 (cond
1.46 ;; Ignore comments.
1.47- ((or (org-in-commented-line) (org-at-table-p))
1.48+ ((or (org-at-comment-p) (org-at-table-p))
1.49 nil)
1.50 ;; Ignore hyperlinks. But if link has a description, count
1.51 ;; the words within the description.
1.52@@ -353,7 +352,7 @@
1.53 ((looking-at org-any-link-re)
1.54 (goto-char (match-end 0)))
1.55 ;; Ignore source code blocks.
1.56- ((org-in-regexps-block-p "^#\\+BEGIN_SRC\\W" "^#\\+END_SRC\\W")
1.57+ ((org-between-regexps-p "^#\\+BEGIN_SRC\\W" "^#\\+END_SRC\\W")
1.58 nil)
1.59 ;; Ignore inline source blocks, counting them as 1 word.
1.60 ((save-excursion
1.61@@ -393,8 +392,8 @@
1.62 (t
1.63 (cl-incf wc))))))
1.64 (re-search-forward "\\w+\\W*")))
1.65- (message (format "%d words in %s." wc
1.66- (if mark-active "region" "buffer")))))
1.67+ (format "%d words in %s." wc
1.68+ (if mark-active "region" "buffer"))))
1.69
1.70 (defun org-check-misformatted-subtree ()
1.71 "Check misformatted entries in the current buffer."
1.72@@ -505,15 +504,15 @@
1.73
1.74 (require 'mm-url) ; to include mm-url-decode-entities-string
1.75
1.76-(defun org-insert-link-with-title ()
1.77- "Insert org link where default description is set to html title."
1.78- (interactive)
1.79- (let* ((url (read-string "URL: "))
1.80- (title (get-html-title-from-url url)))
1.81- (org-insert-link nil url title)))
1.82+(cl-defun get-first-url (&optional (match (rx bol "http" (optional "s") "://")))
1.83+ "Return URL in clipboard, or first URL in the `kill-ring' matching MATCH."
1.84+ (cl-loop for item in (cons (current-kill 0) kill-ring)
1.85+ when (and item (string-match-p match item))
1.86+ return item))
1.87
1.88 (defun get-html-title-from-url (url)
1.89 "Return content in <title> tag."
1.90+ (interactive (list (get-first-url)))
1.91 (let (x1 x2 (download-buffer (url-retrieve-synchronously url)))
1.92 (save-excursion
1.93 (set-buffer download-buffer)
1.94@@ -523,6 +522,17 @@
1.95 (setq x2 (search-backward "<"))
1.96 (mm-url-decode-entities-string (buffer-substring-no-properties x1 x2)))))
1.97
1.98+(defun org-insert-link-with-title (url)
1.99+ "Insert org link where default description is set to html title."
1.100+ (interactive (list (get-first-url match)))
1.101+ (let ((title (get-html-title-from-url url)))
1.102+ (org-insert-link nil url title)))
1.103+
1.104+(defun org-insert-so-link (url)
1.105+ (interactive (list (get-first-url (rx bol "https://" (* anychar) "stackoverflow.com"))))
1.106+ (let ((title (get-html-title-from-url url)))
1.107+ (org-insert-link nil url title)))
1.108+
1.109 (defun org-remove-empty-propert-drawers ()
1.110 "*Remove all empty property drawers in current file."
1.111 (interactive)
1.112@@ -585,6 +595,8 @@
1.113 (defvar org-agenda-extensions '(".org")
1.114 "List of extensions of agenda files")
1.115
1.116+(setq org-agenda-default-appointment-duration 30)
1.117+(setq org-agenda-span 5)
1.118 (defun org-set-agenda-files ()
1.119 (interactive)
1.120 (setq org-agenda-files
1.121@@ -597,6 +609,28 @@
1.122 (with-eval-after-load 'org
1.123 (org-set-agenda-files))
1.124
1.125+;; org-agenda-auto-update
1.126+(defvar org-agenda-update-interval 300)
1.127+(defvar org-agenda-update-timer nil)
1.128+(defvar org-agenda-update-idle t)
1.129+
1.130+(defun org-agenda-update ()
1.131+ (org-agenda-redo-all t))
1.132+
1.133+(defun org-agenda-auto-update ()
1.134+ (when org-agenda-update-timer
1.135+ (setq org-agenda-update-timer
1.136+ (cancel-timer org-agenda-update-timer)))
1.137+ (setq org-agenda-update-timer
1.138+ (if org-agenda-update-idle
1.139+ (run-with-idle-timer org-agenda-update-interval t 'org-agenda-update)
1.140+ ;; when we refresh the org-agenda buffer, also reset the timer
1.141+ (add-hook 'org-agenda-finalize-hook 'org-agenda-auto-update)
1.142+ (run-with-timer org-agenda-update-interval org-agenda-update-interval 'org-agenda-update))))
1.143+
1.144+(with-eval-after-load 'org-agenda
1.145+ (org-agenda-auto-update))
1.146+
1.147 ;;; Skel Config
1.148 (use-package skel
1.149 :requires skel
1.150@@ -754,7 +788,15 @@
1.151 (skt-register-auto-insert ".*[.]lisp" #'skt-template-lisp-head)
1.152 (skt-register-auto-insert ".*[.].rs" #'skt-template-rust-head)
1.153 (auto-insert-mode t)
1.154- (keymap-set skel-minor-mode-map "C-<return>" 'company-tempo))
1.155+ ;; (keymap-set skel-minor-mode-map "C-<return>" 'company-tempo)
1.156+ )
1.157+
1.158+;;; ical2org
1.159+;; go install github.com/rjhorniii/ical2org@latest
1.160+(defun ical2org (file)
1.161+ "Convert ics FILE to an org-mode heading."
1.162+ (interactive "ffile: ")
1.163+ (shell-command (format "ical2org %s -a %s" file org-inbox-file)))
1.164
1.165 ;;; glossary
1.166 ;; (with-eval-after-load 'org-glossary