Compare commits

...

14 Commits

Author SHA1 Message Date
Case Duckworth f479cd9b30 Merge branch 'main' of tildegit.org:acdw/emacs 2022-04-02 13:58:17 -05:00
Case Duckworth 99ddcb1718 Experiment: remove most font-lock faces 2022-04-02 13:56:25 -05:00
Case Duckworth 94c3685e85 Remove binding for crux-visit-shell-buffer
This should've gone with eshell-whatever
2022-04-02 13:56:11 -05:00
Case Duckworth 755bd8b646 Fix arity of affe-orderless-regexp-compiler 2022-04-02 13:55:59 -05:00
Case Duckworth 191a223a1d Add $INFOPATH to Info-additional-directory-list 2022-04-02 13:55:44 -05:00
Case Duckworth 6db8a02175 Add C-x C-m binding for execute-extended-command
On recommendation of Steve Yegge
2022-04-02 13:54:52 -05:00
Case Duckworth 1d64079a52 Ignore errors in +tab-bar-notmuch-count 2022-04-02 13:54:43 -05:00
Case Duckworth 2e488c508f Add +org-unsmartify 2022-04-02 13:54:19 -05:00
Case Duckworth 2876e85cf6 Change notation of settings 2022-04-02 13:54:06 -05:00
Case Duckworth 8f8121e3a2 Add +eshell-here 2022-04-02 13:53:59 -05:00
Case Duckworth abf24e71c7 Enable +elfeed-update-command to run only sometimes 2022-04-02 13:53:39 -05:00
Case Duckworth 8383d8cb8b Change default mpv viewer to cache 2022-04-02 13:52:59 -05:00
Case Duckworth 122ee05071 Add +chicken.el 2022-04-02 13:52:40 -05:00
Case Duckworth 2e46fd9241 Ignore scratch.el 2022-04-02 13:52:23 -05:00
8 changed files with 120 additions and 19 deletions

3
.gitignore vendored
View File

@ -18,3 +18,6 @@ transient/
var/
eshell/*
!eshell/aliases
# put random stuff in here
scratch.el

64
init.el
View File

@ -39,6 +39,7 @@
"C-x o" (lambda () (interactive) (switch-to-buffer nil))
"C-x C-o" #'+open-paragraph
"C-w" #'+kill-word-backward-or-region
"C-x C-m" #'execute-extended-command ; original: coding systems
;; "C-x C-1" #'delete-other-windows
;; "C-x 2" #'+split-window-below-then
;; "C-x C-2" #'+split-window-below-then
@ -342,6 +343,8 @@
eshell-prompt-regexp (rx bol (* (not (any ?# ?$ ?\n)))
" " (any ?# ?$)
(* " ")))
(:+leader "s" #'+eshell-here
"C-s" #'+eshell-here)
(with-eval-after-load 'mwim
(setf (alist-get 'eshell-mode mwim-beginning-of-line-function)
#'eshell-bol))
@ -350,19 +353,19 @@
(dolist (mode '((hungry-delete-mode . -1)))
(funcall (car mode) (cdr mode)))
;; Set local settings
(dolist (setting (list (cons 'outline-regexp eshell-prompt-regexp)
(cons 'page-delimiter eshell-prompt-regexp)
(cons 'imenu-generic-expression
(list "Prompt"
(concat eshell-prompt-regexp
"\\(.*\\)")
1))
(cons 'truncate-lines t)))
(dolist (setting `((outline-regexp . ,eshell-prompt-regexp)
(page-delimiter . ,eshell-prompt-regexp)
(imenu-generic-expression "Prompt"
,(concat eshell-prompt-regexp
"\\(.*\\)")
1)
(truncate-lines . t)
(scroll-margin . 0)))
(set (make-local-variable (car setting)) (cdr setting)))
;; Bind keys
(dolist (binding '(("C-d" . +eshell-quit-or-delete-char)))
(define-key eshell-mode-map
(kbd (car binding)) (cdr binding)))
(kbd (car binding)) (cdr binding)))
;; Environment variables
(dolist (environment '(("PAGER" . "cat")))
(setenv (car environment) (cdr environment)))))
@ -425,6 +428,8 @@
(setup info
(:also-load +Info)
(dolist (dir (split-string (getenv "INFOPATH") ":" t))
(add-to-list 'Info-additional-directory-list dir))
(:with-mode Info-mode ; -_-
(:hook #'reading-mode)
(:bind "c" #'+Info-copy-current-node-name
@ -836,11 +841,11 @@ They are completed by \"M-x TAB\" only in Tramp debug buffers."
(and (executable-find "find")
(executable-find "grep"))))
(:load-after consult orderless vertico)
(setq affe-regexp-compiler (defun affe-orderless-regexp-compiler (input _type)
(setq affe-regexp-compiler (defun affe-orderless-regexp-compiler (input &rest _)
(setq input (orderless-pattern-compiler input))
(cons input (lambda (str) (orderless--highlight input str)))))
(+with-eval-after-loads (affe vertico-multiform)
(setq affe-regexp-compiler (defun affe-orderless-regexp-compiler (input _type)
(setq affe-regexp-compiler (defun affe-orderless-regexp-compiler (input &rest _)
(setq input (orderless-pattern-compiler input))
(cons input (lambda (str) (orderless--highlight input str)))))
(setf (alist-get 'affe-grep vertico-multiform-commands) '(buffer)
@ -1285,7 +1290,6 @@ They are completed by \"M-x TAB\" only in Tramp debug buffers."
"M-w" #'+crux-kill-ring-save
"C-k" #'crux-kill-and-join-forward
"C-c d" #'+crux-insert-date-or-time)
(:+leader "s" #'crux-visit-shell-buffer)
(crux-with-region-or-buffer indent-region)
(el-patch-feature crux)
@ -1394,8 +1398,17 @@ See also `crux-reopen-as-root-mode'."
(:hook #'reading-mode)
(:option +elfeed--update-repeat (* 60 30) ; 1/2 hour
+elfeed--update-first-time 60))
(+elfeed-update-async-mode -1) ; It really messes with stuff for work
)
(+elfeed-update-async-mode +1)
(add-hook '+elfeed-update-proceed-hook (defun non-work-hours? ()
"Return nil if during work hours, t otherwise."
(let* ((now (current-time))
(now* (decode-time now))
(work-start* (append '(0 0 8) (cdddr now*))) ; 8:00 AM
(work-end* (append '(0 0 18) (cdddr now*))) ; 6:00 PM
(work-start (encode-time work-start*))
(work-end (encode-time work-end*)))
(or (time-less-p now work-start)
(time-less-p work-end now))))))
(setup (:straight elfeed-org)
(:also-load +org-capture)
@ -1530,6 +1543,7 @@ See also `crux-reopen-as-root-mode'."
geiser-chicken
macrostep-geiser
scheme-complete)
(:also-load +chicken)
(setf (alist-get "\\.scm\\'" auto-mode-alist nil nil #'string=)
'scheme-mode))
@ -1776,6 +1790,28 @@ See also `crux-reopen-as-root-mode'."
:now)))))
(:face modus-themes-tab-active ((t :bold nil))
modus-themes-tab-inactive ((t :italic t)))
(add-hook 'modus-themes-after-load-theme-hook
(defun +modus-themes-mostly-monochrome ()
"Set up mdous-themes to be mostly monochrome."
(modus-themes-with-colors
(custom-set-faces
`(font-lock-builtin-face ((,class :inherit modus-themes-bold :foreground unspecified)))
`(font-lock-comment-delimiter-face ((,class :inherit font-lock-comment-face)))
`(font-lock-comment-face ((,class :inherit modus-themes-slant :foreground ,fg-docstring)))
`(font-lock-constant-face ((,class :foreground unspecified)))
`(font-lock-doc-face ((,class :inherit modus-themes-slant :foreground ,fg-docstring)))
`(font-lock-function-name-face ((,class :foreground unspecified)))
`(font-lock-keyword-face ((,class :inherit modus-themes-bold :foreground unspecified)))
`(font-lock-negation-char-face ((,class :inherit modus-themes-bold :foreground unspecified)))
`(font-lock-preprocessor-face ((,class :foreground unspecified)))
`(font-lock-regexp-grouping-backslash ((,class :foreground ,fg-escape-char-backslash)))
`(font-lock-regexp-grouping-construct ((,class :foreground ,fg-escape-char-construct)))
`(font-lock-string-face ((,class :inherit modus-themes-slant :foreground unspecified)))
`(font-lock-type-face ((,class :inherit modus-themes-bold :foreground unspecified)))
`(font-lock-variable-name-face ((,class :foreground unspecified)))
`(font-lock-warning-face ((,class :inherit modus-themes-bold :foreground ,red-nuanced-fg)))))))
(dawn-schedule #'modus-themes-load-operandi
#'modus-themes-load-vivendi))

View File

@ -63,7 +63,9 @@ If FALLBACK is non-nil, it's a function to fallback on if the
(funcall fallback url new-window))))))
;; Reference implementation: mpv
(+browse-url-make-external-viewer-handler "mpv" nil "Video URL: ")
(+browse-url-make-external-viewer-handler "mpv" '("--cache-pause-wait=30"
"--cache-pause-initial=yes")
"Video URL: ")
;; And feh too
(+browse-url-make-external-viewer-handler "feh" '("--auto-zoom"
"--geometry" "800x600"))

19
lisp/+chicken.el Normal file
View File

@ -0,0 +1,19 @@
;;; +chicken.el --- Chicken Scheme additions -*- lexical-binding: t; -*-
;;; Commentary:
;;; Code:
;; Reload [[https://wiki.call-cc.org/eggref/5/awful][awful]] with a keybinding
(defun +chicken-awful-reload ()
"Reload awful by visiting /reload."
(interactive)
(save-buffer)
(condition-case e
(url-retrieve-synchronously "http://localhost:8080/reload")
(file-error (message "Couldn't ping awful's server. Is it running?"))
(t (message "Some awful error occurred!"))))
(provide '+chicken)
;;; +chicken.el ends here

View File

@ -133,6 +133,19 @@ If multiple items are selected, don't advance."
(defvar +elfeed--update-first-time 6 "How long to wait for the first time.")
(defvar +elfeed--update-repeat (* 60 15) "How long between updates.")
(defcustom +elfeed-update-proceed-hook nil
"Predicates to query before running `+elfeed-update-command'.
Each hook is passed no arguments."
:type 'hook)
(defun +elfeed-update-command-wrapper ()
"Run `+elfeed-update-command', but only sometimes.
If any of the predicates in `+elfeed-update-proceed-hook' return
nil, don't run `+elfeed-update-command'. If they all return
non-nil, proceed."
(when (run-hook-with-args-until-failure '+elfeed-update-proceed-hook)
(+elfeed-update-command)))
(defun +elfeed--cancel-update-timer ()
"Cancel `+elfeed--update-timer'."
(unless +elfeed--update-running
@ -142,12 +155,10 @@ If multiple items are selected, don't advance."
(defun +elfeed--reinstate-update-timer ()
"Reinstate `+elfeed--update-timer'."
;; First, unload the db
(elfeed-db-save)
(elfeed-db-unload)
(setq +elfeed--update-timer
(run-at-time +elfeed--update-first-time
+elfeed--update-repeat
#'+elfeed-update-command)))
#'+elfeed-update-command-wrapper)))
(define-minor-mode +elfeed-update-async-mode
"Minor mode to update elfeed async-style."

View File

@ -25,6 +25,22 @@ any directory proferred by `consult-dir'."
;;; Start and quit
;; from https://old.reddit.com/r/emacs/comments/1zkj2d/advanced_usage_of_eshell/
(defun +eshell-here ()
"Go to eshell and set current directory to current buffer's."
;; consider: make a new eshell buffer when given a prefix argument.
(interactive)
(let ((dir (file-name-directory (or (buffer-file-name)
default-directory))))
(eshell)
(eshell/pushd ".")
(cd dir)
(goto-char (point-max))
(eshell-kill-input)
(eshell-send-input)
(setq-local scroll-margin 0)
(recenter 0)))
(defun +eshell-quit-or-delete-char (arg)
"Delete the character to the right, or quit eshell on an empty line."
(interactive "p")

View File

@ -568,5 +568,19 @@ and POST-PROCESS are passed to `org-export-to-file'."
(interactive)
(+org-export-clip-to-html nil :subtree))
;;; Unsmartify quotes and dashes and stuff.
(defun +org-unsmartify ()
"Replace \"smart\" punctuation with their \"dumb\" counterparts."
(interactive)
(save-excursion
(goto-char (point-min))
(while (re-search-forward "[“”‘’–—]" nil t)
(let ((replace (pcase (match-string 0)
((or "" "") "\"")
((or "" "") "'")
("" "--")
("" "---"))))
(replace-match replace nil nil)))))
(provide '+org)
;;; +org.el ends here

View File

@ -54,7 +54,7 @@
"Display a notmuch count in the tab-bar."
(when (and (executable-find "notmuch")
(featurep 'notmuch))
(let* ((counts (notmuch-hello-query-counts notmuch-saved-searches))
(let* ((counts (ignore-errors (notmuch-hello-query-counts notmuch-saved-searches)))
(next (cl-find "inbox" counts :key (lambda (l) (plist-get l :name)) :test 'equal))
(next-count (plist-get next :count)))
(when (and next-count (> next-count 0))