about summary refs log tree commit diff stats
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/+browse-url.el4
-rw-r--r--lisp/+chicken.el19
-rw-r--r--lisp/+elfeed.el17
-rw-r--r--lisp/+eshell.el16
-rw-r--r--lisp/+org.el14
-rw-r--r--lisp/+tab-bar.el2
6 files changed, 67 insertions, 5 deletions
diff --git a/lisp/+browse-url.el b/lisp/+browse-url.el index 68fb7b0..dbbfef2 100644 --- a/lisp/+browse-url.el +++ b/lisp/+browse-url.el
@@ -63,7 +63,9 @@ If FALLBACK is non-nil, it's a function to fallback on if the
63 (funcall fallback url new-window)))))) 63 (funcall fallback url new-window))))))
64 64
65;; Reference implementation: mpv 65;; Reference implementation: mpv
66(+browse-url-make-external-viewer-handler "mpv" nil "Video URL: ") 66(+browse-url-make-external-viewer-handler "mpv" '("--cache-pause-wait=30"
67 "--cache-pause-initial=yes")
68 "Video URL: ")
67;; And feh too 69;; And feh too
68(+browse-url-make-external-viewer-handler "feh" '("--auto-zoom" 70(+browse-url-make-external-viewer-handler "feh" '("--auto-zoom"
69 "--geometry" "800x600")) 71 "--geometry" "800x600"))
diff --git a/lisp/+chicken.el b/lisp/+chicken.el new file mode 100644 index 0000000..ef5f616 --- /dev/null +++ b/lisp/+chicken.el
@@ -0,0 +1,19 @@
1;;; +chicken.el --- Chicken Scheme additions -*- lexical-binding: t; -*-
2
3;;; Commentary:
4
5;;; Code:
6
7;; Reload [[https://wiki.call-cc.org/eggref/5/awful][awful]] with a keybinding
8
9(defun +chicken-awful-reload ()
10 "Reload awful by visiting /reload."
11 (interactive)
12 (save-buffer)
13 (condition-case e
14 (url-retrieve-synchronously "http://localhost:8080/reload")
15 (file-error (message "Couldn't ping awful's server. Is it running?"))
16 (t (message "Some awful error occurred!"))))
17
18(provide '+chicken)
19;;; +chicken.el ends here
diff --git a/lisp/+elfeed.el b/lisp/+elfeed.el index 7f9e193..c0b74f0 100644 --- a/lisp/+elfeed.el +++ b/lisp/+elfeed.el
@@ -133,6 +133,19 @@ If multiple items are selected, don't advance."
133(defvar +elfeed--update-first-time 6 "How long to wait for the first time.") 133(defvar +elfeed--update-first-time 6 "How long to wait for the first time.")
134(defvar +elfeed--update-repeat (* 60 15) "How long between updates.") 134(defvar +elfeed--update-repeat (* 60 15) "How long between updates.")
135 135
136(defcustom +elfeed-update-proceed-hook nil
137 "Predicates to query before running `+elfeed-update-command'.
138Each hook is passed no arguments."
139 :type 'hook)
140
141(defun +elfeed-update-command-wrapper ()
142 "Run `+elfeed-update-command', but only sometimes.
143If any of the predicates in `+elfeed-update-proceed-hook' return
144nil, don't run `+elfeed-update-command'. If they all return
145non-nil, proceed."
146 (when (run-hook-with-args-until-failure '+elfeed-update-proceed-hook)
147 (+elfeed-update-command)))
148
136(defun +elfeed--cancel-update-timer () 149(defun +elfeed--cancel-update-timer ()
137 "Cancel `+elfeed--update-timer'." 150 "Cancel `+elfeed--update-timer'."
138 (unless +elfeed--update-running 151 (unless +elfeed--update-running
@@ -142,12 +155,10 @@ If multiple items are selected, don't advance."
142(defun +elfeed--reinstate-update-timer () 155(defun +elfeed--reinstate-update-timer ()
143 "Reinstate `+elfeed--update-timer'." 156 "Reinstate `+elfeed--update-timer'."
144 ;; First, unload the db 157 ;; First, unload the db
145 (elfeed-db-save)
146 (elfeed-db-unload)
147 (setq +elfeed--update-timer 158 (setq +elfeed--update-timer
148 (run-at-time +elfeed--update-first-time 159 (run-at-time +elfeed--update-first-time
149 +elfeed--update-repeat 160 +elfeed--update-repeat
150 #'+elfeed-update-command))) 161 #'+elfeed-update-command-wrapper)))
151 162
152(define-minor-mode +elfeed-update-async-mode 163(define-minor-mode +elfeed-update-async-mode
153 "Minor mode to update elfeed async-style." 164 "Minor mode to update elfeed async-style."
diff --git a/lisp/+eshell.el b/lisp/+eshell.el index bcab846..b874141 100644 --- a/lisp/+eshell.el +++ b/lisp/+eshell.el
@@ -25,6 +25,22 @@ any directory proferred by `consult-dir'."
25 25
26;;; Start and quit 26;;; Start and quit
27 27
28;; from https://old.reddit.com/r/emacs/comments/1zkj2d/advanced_usage_of_eshell/
29(defun +eshell-here ()
30 "Go to eshell and set current directory to current buffer's."
31 ;; consider: make a new eshell buffer when given a prefix argument.
32 (interactive)
33 (let ((dir (file-name-directory (or (buffer-file-name)
34 default-directory))))
35 (eshell)
36 (eshell/pushd ".")
37 (cd dir)
38 (goto-char (point-max))
39 (eshell-kill-input)
40 (eshell-send-input)
41 (setq-local scroll-margin 0)
42 (recenter 0)))
43
28(defun +eshell-quit-or-delete-char (arg) 44(defun +eshell-quit-or-delete-char (arg)
29 "Delete the character to the right, or quit eshell on an empty line." 45 "Delete the character to the right, or quit eshell on an empty line."
30 (interactive "p") 46 (interactive "p")
diff --git a/lisp/+org.el b/lisp/+org.el index 3d14c52..2a57fe2 100644 --- a/lisp/+org.el +++ b/lisp/+org.el
@@ -568,5 +568,19 @@ and POST-PROCESS are passed to `org-export-to-file'."
568 (interactive) 568 (interactive)
569 (+org-export-clip-to-html nil :subtree)) 569 (+org-export-clip-to-html nil :subtree))
570 570
571;;; Unsmartify quotes and dashes and stuff.
572(defun +org-unsmartify ()
573 "Replace \"smart\" punctuation with their \"dumb\" counterparts."
574 (interactive)
575 (save-excursion
576 (goto-char (point-min))
577 (while (re-search-forward "[“”‘’–—]" nil t)
578 (let ((replace (pcase (match-string 0)
579 ((or "“" "”") "\"")
580 ((or "‘" "’") "'")
581 ("–" "--")
582 ("—" "---"))))
583 (replace-match replace nil nil)))))
584
571(provide '+org) 585(provide '+org)
572;;; +org.el ends here 586;;; +org.el ends here
diff --git a/lisp/+tab-bar.el b/lisp/+tab-bar.el index f0c4f62..1f4745d 100644 --- a/lisp/+tab-bar.el +++ b/lisp/+tab-bar.el
@@ -54,7 +54,7 @@
54 "Display a notmuch count in the tab-bar." 54 "Display a notmuch count in the tab-bar."
55 (when (and (executable-find "notmuch") 55 (when (and (executable-find "notmuch")
56 (featurep 'notmuch)) 56 (featurep 'notmuch))
57 (let* ((counts (notmuch-hello-query-counts notmuch-saved-searches)) 57 (let* ((counts (ignore-errors (notmuch-hello-query-counts notmuch-saved-searches)))
58 (next (cl-find "inbox" counts :key (lambda (l) (plist-get l :name)) :test 'equal)) 58 (next (cl-find "inbox" counts :key (lambda (l) (plist-get l :name)) :test 'equal))
59 (next-count (plist-get next :count))) 59 (next-count (plist-get next :count)))
60 (when (and next-count (> next-count 0)) 60 (when (and next-count (> next-count 0))