From e037d2fb71b533b506469d78a58ff351194d6e36 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Thu, 13 Jan 2022 18:01:12 -0600 Subject: Whatever --- init.el | 71 ++++++++++++++++++++++++++++++++++++++++---------------- lisp/+tab-bar.el | 8 +++++++ lisp/remember.el | 19 ++++++++++++--- 3 files changed, 75 insertions(+), 23 deletions(-) diff --git a/init.el b/init.el index d1dc6e3..36c2bed 100644 --- a/init.el +++ b/init.el @@ -113,7 +113,7 @@ (+ensure-after-init #'+pulse-location-mode)) (setup (:require reading) - (:hook-into view-mode) ; XXX doesn't go back + ;;(:hook-into view-mode) ; XXX doesn't go back ) (setup (:require user-save) @@ -164,10 +164,11 @@ "pixelfed" "instagram.com" "bibliogram.art" "reddit.com" "teddit.net" "taskiq" - "twitter.com" "nitter.net" - "streamable.com" + "twitter.com" "nitter.net" "t.co" + "streamable.com" "spotify.com" "hetzner.cloud")) - (add-to-list '+browse-url-secondary-browser-regexps domain)) + (add-to-list '+browse-url-secondary-browser-regexps + (replace-regexp-in-string "\\." "\\\\." domain))) ;; Set up URL handlers. (+browse-url-set-handlers (list @@ -428,7 +429,6 @@ (string-match-p "lisp/org\\'" path)) load-path)) (:also-load +org - ox-md _work) (:option org-adapt-indentation nil org-archive-mark-done t @@ -444,12 +444,6 @@ org-cycle-separator-lines 0 org-directory (sync/ "org/" t) org-ellipsis truncate-string-ellipsis - org-export-coding-system 'utf-8-unix - org-export-headline-levels 8 - org-export-with-section-numbers nil - org-export-with-smart-quotes t - org-export-with-sub-superscripts t - org-export-with-toc nil org-fontify-done-headline t org-fontify-quote-and-verse-blocks t org-fontify-whole-heading-line t @@ -553,6 +547,17 @@ (:option org-contacts-matcher "contact") ; Contacts are tagged "contact" ) +(setup org-export + (:also-load ox-md) + (:option org-export-coding-system 'utf-8-unix + org-export-headline-levels 8 + org-export-with-section-numbers nil + org-export-with-smart-quotes t + org-export-with-sub-superscripts t + org-export-with-toc nil) + (with-eval-after-load 'user-save + (add-hook 'org-export-before-processing-hook #'user-save-buffer))) + (setup prog (:local-set comment-auto-fill-only-comments t) (:hook #'prettify-symbols-mode @@ -572,7 +577,7 @@ (setup tab-bar (:require +tab-bar) - (:option tab-bar-tab-name-function '+tab-bar-tab-name-truncated-left + (:option tab-bar-tab-name-function '+tab-bar-basename tab-bar-tab-name-truncated-max 20 tab-bar-tab-name-ellipsis truncate-string-ellipsis tab-bar-show t) @@ -583,7 +588,8 @@ (:hook #'turn-on-auto-fill)) (setup time - (:option display-time-format "%H:%M") + (:option display-time-format "%H:%M" + display-time-default-load-average nil) (display-time-mode +1)) (setup (:straight 0x0) @@ -620,13 +626,22 @@ (setup (:straight-when (apheleia :host github :repo "raxod502/apheleia") - (executable-find "diff")) + (eq system-type 'gnu/linux)) (:require apheleia +apheleia) + ;; (setf (alist-get 'prettier apheleia-formatters) + ;; '("npx" "prettier" "--stdin-filepath" filepath)) (apheleia-global-mode +1)) (setup (:straight avy) (:require avy +avy) + (:option avy-background t + avy-lead-faces + '(avy-lead-face + avy-lead-face-1 avy-lead-face-1 avy-lead-face-1 + avy-lead-face-1 avy-lead-face-1 avy-lead-face-1)) + (:face avy-background-face + ((t (:foreground "#888888")))) (:+key "M-j" #'avy-goto-char-timer) (:bind-into isearch "M-j" #'avy-isearch) @@ -779,7 +794,14 @@ (,(+lui-make-formatting-list-rx "_") 1 lui-emphasis-face) (,(+lui-make-formatting-list-rx "/") - 1 lui-emphasis-face))) + 1 lui-emphasis-face)) + lui-autopaste-function + (defun +0x0-upload-string (string) + "Upload a string using 0x0." + (with-temp-buffer + (insert string) + (0x0-upload-text (0x0--choose-server))) + (current-kill 0))) (add-to-list '+pulse-location-commands #'lui-track-jump-to-indicator) (:hook #'visual-line-mode #'enable-lui-track @@ -787,7 +809,8 @@ (defun +disable-electric-pair-mode () "Disable `electric-pair-mode' in the current buffer." (interactive) - (electric-pair-local-mode -1))) + (electric-pair-local-mode -1)) + #'enable-lui-autopaste) (:local-set fringes-outside-margins t right-margin-width (length lui-time-stamp-format) scroll-margin 0 @@ -973,6 +996,7 @@ See also `crux-reopen-as-root-mode'." elfeed-show-unique-buffers t elfeed-db-directory (elfeed/ "db/" t)) (:+key "C-x w" #'elfeed) + (advice-add #'elfeed-search-fetch :after #'beginning of buffer) (:with-mode elfeed-search-mode (:bind "&" #'+elfeed-search-browse-generic) (:hook #'hl-line-mode) @@ -1190,7 +1214,10 @@ See also `crux-reopen-as-root-mode'." (keychain-refresh-environment)) (setup (:straight lacarte) - (:+key "" #'lacarte-execute-menu-command)) + (:+key "" #'lacarte-execute-menu-command) + (with-eval-after-load 'vertico-multiform + (setf (alist-get 'lacarte-execute-menu-command vertico-multiform-commands) + '(buffer grid (vertico-sort-function . vertico-sort-length-alpha))))) (setup (:straight (lin :host gitlab :repo "protesilaos/lin")) (require 'lin) @@ -1240,7 +1267,8 @@ See also `crux-reopen-as-root-mode'." :host gitlab :repo "protesilaos/modus-themes")) (require 'modus-themes (.etc "straight/build/modus-themes/modus-themes")) - (:option modus-themes-bold-constructs t + (:option modus-themes-mixed-fonts t + modus-themes-bold-constructs t modus-themes-italic-constructs t modus-themes-headings '((t . (background)))) (+sunrise-sunset 'modus-themes-load-operandi 'modus-themes-load-vivendi)) @@ -1324,7 +1352,8 @@ See also `crux-reopen-as-root-mode'." (setup (:straight (simple-modeline :fork (:host github :repo "duckwork/simple-modeline"))) (:require +modeline) - (:option simple-modeline-segments + (:option +modeline-minions-icon ";" + simple-modeline-segments `(( ; left +modeline-ace-window-display +modeline-modified @@ -1361,7 +1390,9 @@ See also `crux-reopen-as-root-mode'." :host github :repo "duckwork/sophomore.el")) (sophomore-enable #'narrow-to-region) - (sophomore-disable #'view-hello-file) + (sophomore-disable ; These are mostly annoying commands + #'view-hello-file + #'describe-gnu-project) (sophomore-mode +1)) (setup (:straight ssh-config-mode) diff --git a/lisp/+tab-bar.el b/lisp/+tab-bar.el index 1dc1f68..1ee7606 100644 --- a/lisp/+tab-bar.el +++ b/lisp/+tab-bar.el @@ -21,6 +21,14 @@ (defvar +tab-bar-show-original nil "Original value of `tab-bar-show'.") +(defun +tab-bar-basename () + "Generate the tab name from the basename of the buffer of the + selected window." + (let* ((tab-file-name (buffer-file-name (window-buffer (minibuffer-selected-window))))) + (if tab-file-name + (file-name-nondirectory tab-file-name) + (+tab-bar-tab-name-truncated-left)))) + (defun +tab-bar-tab-name-truncated-left () "Generate the tab name from the buffer of the selected window. This is just like `tab-bar-tab-name-truncated', but truncates the diff --git a/lisp/remember.el b/lisp/remember.el index 39476d1..a759419 100644 --- a/lisp/remember.el +++ b/lisp/remember.el @@ -1,4 +1,17 @@ -;; ABANDON ALL HOPE YE WHO ENTER HERE +;;; remember.el --- Remember variables and modes -*- lexical-binding: t; -*- + +;;; Code: + +(defmacro remember-remember (alist) + (let* ((template (format "remember--%s-%%s" (gensym))) + (reset-fn (intern (format template "recall"))) + (things (cl-loop for (sym . newval) in alist + as rem = (intern (format template sym)) + + ;; Collect original values + + ))))) + (defmacro remember-set (&rest symbols) "Setup a closure remembering symbols to apply with @@ -6,7 +19,7 @@ SYMBOLS is a plist: the properties are symbols or mode names, and their values what to set after `remember-setup'." (let* ((template (format "remember--%s-%%s" (gensym))) - (reset-fn (intern (format template "reset" "fn"))) + (reset-fn (intern (format template "reset"))) (list (cl-loop for sym in symbols by #'cddr collect `(,(intern (format template sym)) ,sym) @@ -39,5 +52,5 @@ their values what to set after `remember-setup'." ;; test -(setq fn (remember-set display-fill-column-indicator-mode disable)) +(set 'fn (remember-set display-fill-column-indicator-mode disable)) (funcall fn) -- cgit 1.4.1-21-gabe81