This commit is contained in:
Case Duckworth 2022-01-18 17:18:06 -06:00
parent c3601eaf2f
commit efc08126f7
11 changed files with 313 additions and 62 deletions

View File

@ -24,13 +24,13 @@
;;(setq debug-on-error t)
(message "Loading early-init.el...")
;; (define-advice load (:before (feature &rest _))
;; "Message the user when loading a library."
;; (with-temp-message (format "Now loading: '%s'" feature)))
(define-advice load (:before (feature &rest _))
"Message the user when loading a library."
(with-temp-message (format "Now loading: '%s'" feature)))
;;; Speed up init
;; (setq gc-cons-threshold most-positive-fixnum)
(setq gc-cons-threshold most-positive-fixnum)
(add-hook 'emacs-startup-hook
(defun emacs-startup@restore-values ()

View File

@ -12,3 +12,26 @@ vterm
cat ~/Sync/fonts-debian.txt | sudo xargs apt install
cat ~/Sync/fonts-debian.txt | sudo xargs apt install -y
alias e='find-file $*'
emacs --debug-init
apt search xfce
sudo apt install bluebird-gtk-theme blackbird-gtk-theme greybird-gtk-theme xfce4-mount-plugin
apt search icons
sudo apt install elementary-xfce-icon-theme
apt search elementary
apt search wingpanel
apt search elementary
cd ~/src
ls
git clone https://github.com/elementary/stylesheet.git elementary-gtk-stylesheet
cd elementary-gtk-stylesheet/
meson build --prefix=~/.local
meson build --prefix=$HOME/.local
sudo apt install meson ninja sassc
sudo apt install meson sassc
meson build --prefix=$HOME/.local
cd build
ninja install
ninja clean
sudo apt install gimp
(derived-mode-p 'eshell-mode)
echo $PAGER

View File

@ -9,3 +9,8 @@
/home/case/Sync
/home/case
/home/case/.emacs.d
/home/case/Sync/emacs/private
/home/case/src
/home/case/src/elementary-gtk-stylesheet
/home/case/src/elementary-gtk-stylesheet/build
~

91
init.el
View File

@ -413,13 +413,13 @@
;; Brand new for Emacs 28: see https://ruzkuku.com/texts/emacs-mouse.html
;; Actually, look at this as well: https://www.emacswiki.org/emacs/Mouse3
(when (fboundp 'context-menu-mode)
;; (:option context-menu-functions
;; '(context-menu-ffap
;; context-menu-region
;; context-menu-undo
;; context-menu-dictionary))
(:option context-menu-functions
'(context-menu-ffap
context-menu-region
context-menu-undo
context-menu-dictionary))
(context-menu-mode +1))
(dolist (click '( ; Fix scrolling in the margin
(dolist (click '(;; Fix scrolling in the margin
wheel-down double-wheel-down triple-wheel-down
wheel-up double-wheel-up triple-wheel-up))
(global-set-key (vector 'right-margin click) 'mwheel-scroll)
@ -624,11 +624,52 @@
(setup time
;; TODO: +display-time-mode with MOAR customizations
(:option display-time-format "%H:%M %a %e"
display-time-default-load-average nil
(:option display-time-default-load-average nil
display-time-mail-file :disable)
(with-eval-after-load 'discord
(with-eval-after-load '+tab-bar
(:option display-time-string-forms
'((propertize (format-time-string "%H:%M %a %e" now)
'face '+tab-bar-extra
'help-echo (discord-date-string))
load
(if mail
(concat " "
(propertize
display-time-mail-string
'display `(when (and display-time-use-mail-icon
(display-graphic-p))
,@display-time-mail-icon
,@(when (and
display-time-mail-face
(memq
(plist-get
(cdr display-time-mail-icon)
:type)
'(pbm xbm)))
(let ((bg (face-attribute
display-time-mail-face
:background)))
(when (stringp bg)
(list :background bg)))))
'face display-time-mail-face))
"")
" "))))
(display-time-mode +1))
(setup tramp
(el-patch-feature tramp)
(with-eval-after-load 'tramp
(el-patch-defun tramp-debug-buffer-command-completion-p (_symbol buffer)
"A predicate for Tramp interactive commands.
They are completed by \"M-x TAB\" only in Tramp debug buffers."
(with-current-buffer buffer
(el-patch-wrap 2
(save-restriction
(widen)
(string-equal (buffer-substring 1 10) ";; Emacs:")))))))
(setup (:straight 0x0)
(:option 0x0-default-server 'ttm)
(with-eval-after-load 'embark
@ -1013,7 +1054,7 @@ See also `crux-reopen-as-root-mode'."
(electric-cursor-mode +1))
(setup (:straight elfeed)
(:also-load +elfeed)
(:require +elfeed)
(+define-dir elfeed/ (sync/ "emacs/elfeed/" t))
(:option
elfeed-curl-program-name (executable-find "curl")
@ -1044,10 +1085,7 @@ See also `crux-reopen-as-root-mode'."
"&" #'+elfeed-show-browse-generic
"RET" #'shr-browse-url)
(:hook #'reading-mode)
;; (define-advice elfeed-show-entry (:after (&rest _))
;; "Re-flow the entry a short time after showing it."
;; (run-at-time 0.1 nil #'elfeed-show-refresh))
))
(+elfeed-update-async-mode +1)))
(setup (:straight elfeed-org)
(:also-load +org-capture)
@ -1210,6 +1248,8 @@ See also `crux-reopen-as-root-mode'."
(setup (:straight hungry-delete)
(:option hungry-delete-chars-to-skip " \t"
hungry-delete-join-reluctantly nil)
(+with-ensure-after-init
(add-to-list 'hungry-delete-except-modes 'eshell-mode))
(:bind-into paredit
;; I define these functions here because they really require both packages
;; to make any sense. So, would I put them in `+hungry-delete' or
@ -1295,6 +1335,17 @@ See also `crux-reopen-as-root-mode'."
(setf (alist-get 'markdown-mode apheleia-mode-alist) 'markdownfmt)
(setf (alist-get 'gfm-mode apheleia-mode-alist) 'markdownfmt))))
(setup (:straight mastodon)
(:option mastodon-instance-url "https://tiny.tilde.website"
mastodon-client--token-file (.etc "mastodon.plstore")
mastodon-auth-source-file (car auth-sources)
mastodon-tl--enable-proportional-fonts t
mastodon-tl--show-avatars t)
(:hook #'mastodon-async-mode
#'reading-mode
#'hl-line-mode
#'lin-mode))
(setup (:straight minions)
(minions-mode +1))
@ -1647,13 +1698,6 @@ See also `crux-reopen-as-root-mode'."
(sync/ "emacs/snippets" t)))
(yas-global-mode +1))
(setup (:straight zoom-frm))
(setup (:straight zzz-to-char)
(:require +zzz-to-char)
(:option zzz-to-char-reach 1024)
(:global "M-z" #'+zzz-to-char))
(setup (:straight (ytdious
:host github :repo "spiderbit/ytdious"
:fork (:host github :repo "duckwork/ytdious")))
@ -1662,3 +1706,10 @@ See also `crux-reopen-as-root-mode'."
(concat "https://" +invidious-host)
"https://invidious.snopyta.org"))
(:bind "y" #'+ytdious-watch))
(setup (:straight zoom-frm))
(setup (:straight zzz-to-char)
(:require +zzz-to-char)
(:option zzz-to-char-reach (+bytes 1 :kib))
(:global "M-z" #'+zzz-to-char))

View File

@ -2,8 +2,6 @@
;;; Code:
(require 'elfeed)
;; https://karthinks.com/software/lazy-elfeed/
(defun +elfeed-scroll-up-command (&optional arg)
"Scroll up or go to next feed item in Elfeed"
@ -31,5 +29,78 @@
(interactive)
(elfeed-show-visit t))
;;; Fetch feeds async
;; https://github.com/skeeto/elfeed/issues/367
(defun +elfeed--update-message ()
(message "[Elfeed] Update in progress")
'ignore)
(defvar +elfeed--update-running nil "Whether an update is currently running.")
(defun +elfeed-update-command ()
(interactive)
(let ((script (expand-file-name "~/.local/bin/elfeed")))
(message "[Elfeed] Updating in the background.")
(setq +elfeed--update-running t)
(elfeed-db-save)
(advice-add 'elfeed :override #'+elfeed--update-message)
(ignore-errors (kill-buffer "*elfeed-search*"))
(ignore-errors (kill-buffer "*elfeed-log*"))
(elfeed-db-unload)
(unless (file-exists-p script)
(make-directory (file-name-directory script) :parents)
(with-temp-buffer
(insert "(progn\n"
" (load (locate-user-emacs-file \"early-init\"))\n"
" (straight-use-package 'elfeed)\n"
" (require 'elfeed)\n"
" (elfeed)\n"
" (elfeed-update)\n"
" (while (> (elfeed-queue-count-total) 0)\n"
" (sleep-for 5)\n"
" (message \"%s\" (elfeed-queue-count-total))\n"
" (accept-process-output))\n"
" (elfeed-db-save-safe)\n"
" (elfeed-db-gc-safe))")
(write-file script)))
(set-process-sentinel (start-process-shell-command
"Elfeed" nil (concat "emacs --script " script))
(lambda (a b)
(advice-remove 'elfeed #'+elfeed--update-message)
(setq +elfeed--update-running nil)
(message "[Elfeed] Background update %s."
(string-trim b))))))
(defvar +elfeed--update-timer nil "Timer for `elfeed-update-command'.")
(defvar +elfeed--update-first-time 6 "How long to wait for the first time.")
(defvar +elfeed--update-repeat (* 60 15) "How long between updates.")
(defun +elfeed--cancel-update-timer ()
"Cancel `+elfeed--update-timer'."
(unless +elfeed--update-running
(ignore-errors (cancel-timer +elfeed--update-timer))
(setq +elfeed--update-timer nil)))
(defun +elfeed--reinstate-update-timer ()
"Reinstate `+elfeed--update-timer'."
(setq +elfeed--update-timer
(run-at-time +elfeed--update-first-time
+elfeed--update-repeat
#'+elfeed-update-command)))
(define-minor-mode +elfeed-update-async-mode
"Minor mode to update elfeed async-style every 15 minutes."
:global t
(if +elfeed-update-async-mode
(progn ; enable
(+elfeed--reinstate-update-timer)
(advice-add 'elfeed :before '+elfeed--cancel-update-timer)
(advice-add 'elfeed-search-quit-window :after '+elfeed--reinstate-update-timer))
(progn ; disable
(advice-remove 'elfeed '+elfeed--cancel-update-timer)
(advice-remove 'elfeed-search-quit-window '+elfeed--reinstate-update-timer)
(+elfeed--cancel-update-timer))))
(provide '+elfeed)
;;; +elfeed.el ends here

View File

@ -91,10 +91,10 @@ something, it's really annoying to work with."
,@forms)
(when (featurep 'eshell)
`(dolist (buf (buffer-list))
(with-current-buffer buf
(when (derived-mode-p 'eshell-mode)
(+eshell@setup)))))
'(add-hook 'eshell-mode-hook #'+eshell@setup)))
(with-current-buffer buf
(when (derived-mode-p 'eshell-mode)
(+eshell@setup)))))
(add-hook 'eshell-mode-hook #'+eshell@setup)))
(provide '+eshell)
;;; +eshell.el ends here

View File

@ -433,8 +433,12 @@ the deletion might narrow the column."
(when (and (memq this-char-type types) (memq prev-char-type types))
(backward-char)
(setq type prev-char-type)) ; what the fuckckckckck
(if (memq type types)
(progn (org-open-at-point arg))
;; Okay, so this ^ is pretty janky and doesn't /really/ work that well,
;; especially on DEADLINE (and probably SCHEDULED) lines. However, since
;; I really just want to open the list of URLs /most of the time/, I'm
;; fixing it like this instead.
(unless (and (memq type types)
(ignore-errors (org-open-at-point arg)))
(while (not
(progn
(org-back-to-heading)

41
lisp/+straight.el Normal file
View File

@ -0,0 +1,41 @@
;;; +straight.el --- Straight.el extras -*- lexical-binding: t; -*-
;;; Commentary:
;;; Code:
(defun +straight-update-package (package &optional recursive)
"Update PACKAGE using straight.
This pulls, rebuilds, and loads the updated PACKAGE."
(interactive (list (straight--select-package "Update package"
#'straight--installed-p)
current-prefix-arg))
(+with-message (format "Pulling package `%s'%s" package
(if recursive " and deps" ""))
(funcall (if recursive
#'straight-pull-package-and-deps
#'straight-pull-package)
package
:from-upstream))
(+with-message (format "Rebuilding package `%s'%s" package
(if recursive " and deps" ""))
(straight-rebuild-package package recursive))
(+with-message (format "Loading package `%s'%s" package
(if recursive " and deps" ""))
(ignore-errors (load-library (symbol-name package)))
(when recursive
(dolist (dep (straight--get-transitive-dependencies package))
(ignore-errors (load-library (symbol-name package)))))))
(defun +straight-update-all (from-upstream)
"Update all installed packages using straight.
This pulls and rebuilds all packages at once. It does not reload
all of them, for reasons that should be obvious.
With a prefix argument, it also pulls the packages FROM-UPSTREAM."
(interactive "P")
(straight-pull-all from-upstream)
(straight-rebuild-all))
(provide '+straight)
;;; +straight.el ends here

View File

@ -22,7 +22,7 @@
`((global menu-item ,(string-trim-right
(format-mode-line mode-line-misc-info))
ignore)))
ignore :help (discord-date-string))))
(defvar +tab-bar-show-original nil
"Original value of `tab-bar-show'.")
@ -129,35 +129,30 @@ Used by `tab-bar-format-menu-bar'."
;;; Tab bar format tabs
(require 'el-patch)
(el-patch-defun tab-bar--format-tab (tab i)
(append
(el-patch-remove
`((,(intern (format "sep-%i" i)) menu-item ,(tab-bar-separator) ignore)))
(cond
((eq (car tab) 'current-tab)
`((current-tab
menu-item
,(funcall tab-bar-tab-name-format-function tab i)
ignore
:help "Current tab")))
(t
`((,(intern (format "tab-%i" i))
menu-item
,(funcall tab-bar-tab-name-format-function tab i)
,(or
(alist-get 'binding tab)
`(lambda ()
(interactive)
(tab-bar-select-tab ,i)))
:help "Click to visit tab"))))
`((,(if (eq (car tab) 'current-tab) 'C-current-tab (intern (format "C-tab-%i" i)))
menu-item ""
,(or
(alist-get 'close-binding tab)
`(lambda ()
(interactive)
(tab-bar-close-tab ,i)))))))
(el-patch-feature tab-bar)
(with-eval-after-load 'tab-bar
(el-patch-defun tab-bar--format-tab (tab i)
"Format TAB using its index I and return the result as a keymap."
(append
(el-patch-remove
`((,(intern (format "sep-%i" i)) menu-item ,(tab-bar-separator) ignore)))
(cond
((eq (car tab) 'current-tab)
`((current-tab
menu-item
,(funcall tab-bar-tab-name-format-function tab i)
ignore
:help "Current tab")))
(t
`((,(intern (format "tab-%i" i))
menu-item
,(funcall tab-bar-tab-name-format-function tab i)
,(alist-get 'binding tab)
:help "Click to visit tab"))))
(when (alist-get 'close-binding tab)
`((,(if (eq (car tab) 'current-tab) 'C-current-tab (intern (format "C-tab-%i" i)))
menu-item ""
,(alist-get 'close-binding tab)))))))
;; Emacs 27

View File

@ -248,5 +248,29 @@ With optional ARG (\\[universal-argument]), just split."
(interactive "P")
(+split-window-then :below arg))
(defun +bytes (number unit)
"Convert NUMBER UNITs to bytes.
UNIT can be one of :kb, :mb, :gb, :tb, :pb, :eb, :zb, :yb; :kib, :mib, :gib,
:tib, :pib, :eib, :zib, :yib."
(* number (pcase unit
;; Base 10 units
(:kb 1000)
(:mb (* 1000 1000))
(:gb (* 1000 1000 1000))
(:tb (* 1000 1000 1000 1000))
(:pb (* 1000 1000 1000 1000 1000))
(:eb (* 1000 1000 1000 1000 1000 1000))
(:zb (* 1000 1000 1000 1000 1000 1000 1000))
(:yb (* 1000 1000 1000 1000 1000 1000 1000 1000))
;; Base 2 units
(:kib 1024)
(:mib (* 1024 1024))
(:gib (* 1024 1024 1024))
(:tib (* 1024 1024 1024 1024))
(:pib (* 1024 1024 1024 1024 1024))
(:eib (* 1024 1024 1024 1024 1024 1024))
(:zib (* 1024 1024 1024 1024 1024 1024 1024))
(:yib (* 1024 1024 1024 1024 1024 1024 1024 1024)))))
(provide 'acdw)
;;; acdw.el ends here

37
lisp/fibs.el Normal file
View File

@ -0,0 +1,37 @@
;;; fibs.el --- Play backgammon with FIBS -*- lexical-binding: t; -*-
;;; Commentary:
;; fibs.com is one of the oldest backgammon servers out there, and it's
;; accessible via telnet. This package provides a wrapper to enable you to play
;; backgammon on fibs.com more easily than just opening a telnet session
;; yourself.
;;; TODO:
;; - Automatically log in.
;; - Add a `fibs-quit' function to kill the telnet server and buffer.
;;; Code:
(require 'telnet)
(defgroup fibs nil
"Customizations for FIBS, the First Internet Backgammon Server."
:group 'games)
(defcustom fibs-server "fibs.com"
"The server to connect to FIBS with."
:type 'string)
(defcustom fibs-port 4321
"The port to connect to FIBS with."
:type 'number)
;;;###autoload
(defun fibs ()
(interactive)
(telnet fibs-server fibs-port))
(provide 'fibs)
;;; fibs.el ends here