From 989171268461a0069ecd53a49e6098ce08638102 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Fri, 5 May 2023 09:58:21 -0500 Subject: changes --- basics.el | 48 +++-- early-init.el | 16 +- init.el | 617 ++++++++++++++++++++++++++--------------------------- lisp/acdw-chat.el | 96 ++++++--- lisp/acdw-mail.el | 87 +++++++- lisp/acdw-org.el | 111 +++++++--- lisp/acdw-shell | 0 lisp/acdw-shell.el | 32 +-- lisp/acdw-web.el | 30 ++- lisp/acdw.el | 7 + 10 files changed, 608 insertions(+), 436 deletions(-) delete mode 100644 lisp/acdw-shell diff --git a/basics.el b/basics.el index 15831d3..1405c84 100644 --- a/basics.el +++ b/basics.el @@ -192,7 +192,7 @@ auto-save-interval 1 auto-save-no-message t auto-save-timeout 1 - auto-save-visited-interval 10 + auto-save-visited-interval 1 remote-file-name-inhibit-auto-save-visited t) (add-to-list 'auto-save-file-name-transforms `(".*" ,(etc/ "auto-save/" t) t)) @@ -202,7 +202,12 @@ version-control t kept-new-versions 8 kept-old-versions 8 - delete-old-versions t) + delete-old-versions t + backup-directory-alist + `(("^/dev/shm" . nil) + ("^/tmp" . nil) + (,(getenv "XDG_RUNTIME_DIR") . nil) + ("." . ,(no-littering-expand-etc-file-name "backup")))) (require 'recentf) (setq-default ;; recentf-save-file (etc/ "recentf" t) @@ -213,6 +218,7 @@ (add-to-list 'recentf-exclude etc/) (add-to-list 'recentf-exclude "-autoloads.el\\'") (add-hook 'buffer-list-update-hook #'recentf-track-opened-file) +(add-hook 'after-save-hook #'recentf-save-list) (recentf-mode) (require 'saveplace) @@ -247,7 +253,8 @@ (setq-default native-comp-async-report-warnings-errors 'silent native-comp-deferred-compilation t native-compile-target-directory (etc/ "eln" t)) -(add-to-list 'native-comp-eln-load-path native-compile-target-directory) +(when (boundp 'native-comp-eln-load-path) + (add-to-list 'native-comp-eln-load-path native-compile-target-directory)) (when (fboundp 'startup-redirect-eln-cache) (startup-redirect-eln-cache native-compile-target-directory)) @@ -373,19 +380,19 @@ When at the beginning of a line, delete blank lines before point." (when (fboundp '+lisp-comment-or-uncomment-sexp) (define-key lisp-mode-map (kbd "C-M-;") #'+lisp-comment-or-uncomment-sexp) (define-key emacs-lisp-mode-map (kbd "C-M-;") - #'+lisp-comment-or-uncomment-sexp) + #'+lisp-comment-or-uncomment-sexp) (with-eval-after-load 'scheme (define-key scheme-mode-map (kbd "C-M-;") - #'+lisp-comment-or-uncomment-sexp))) + #'+lisp-comment-or-uncomment-sexp))) (define-key emacs-lisp-mode-map (kbd "C-c C-c") - #'eval-defun) + #'eval-defun) (define-key emacs-lisp-mode-map (kbd "C-c C-k") - #'elisp-eval-region-or-buffer) + #'elisp-eval-region-or-buffer) (define-key lisp-interaction-mode-map (kbd "C-c C-c") - #'eval-defun) + #'eval-defun) (define-key lisp-interaction-mode-map (kbd "C-c C-k") - #'elisp-eval-region-or-buffer) + #'elisp-eval-region-or-buffer) (define-advice eval-region (:around (orig start end &rest args) pulse) (apply orig start end args) (pulse-momentary-highlight-region start end)) @@ -432,7 +439,7 @@ When at the beginning of a line, delete blank lines before point." :load-path private/) (use-package custom-allowed - :load-path "/home/case/src/emacs/custom-allowed/" + :load-path "~/src/custom-allowed.el/" :config (add-to-list 'custom-allowed-variables 'safe-local-variable-values) (add-to-list 'custom-allowed-variables 'ispell-buffer-session-localwords) @@ -445,7 +452,7 @@ When at the beginning of a line, delete blank lines before point." (after-init-hook . custom-allowed-load-custom-file)) (use-package sophomore - :load-path "/home/case/src/emacs/sophomore/" + :load-path "~/src/sophomore.el/" :config (sophomore-enable-all) (sophomore-disable 'view-hello-file @@ -463,7 +470,7 @@ When at the beginning of a line, delete blank lines before point." (setq vertico-cycle t) (add-hook 'vertico-mode-hook (defun vertico-mode@fix-completions () - (setopt completion-in-region-function + (setq completion-in-region-function (if vertico-mode #'consult-completion-in-region #'completion--in-region)))) @@ -596,15 +603,15 @@ When at the beginning of a line, delete blank lines before point." ;; Optionally make narrowing help available in the minibuffer. ;; You may want to use `embark-prefix-help-command' or which-key instead. (define-key consult-narrow-map (vconcat consult-narrow-key "?") - #'consult-narrow-help)) + #'consult-narrow-help)) (use-package orderless :ensure t :demand t :init - (setopt completion-styles '(orderless substring basic) - completion-category-defaults nil - completion-category-overrides - '((file (styles basic partial-completion orderless))))) + (setq completion-styles '(orderless substring basic) + completion-category-defaults nil + completion-category-overrides + '((file (styles basic partial-completion orderless))))) (use-package marginalia :ensure t :demand t @@ -618,7 +625,7 @@ When at the beginning of a line, delete blank lines before point." ("M-." . embark-dwim) ("C-h B" . embark-bindings)) :init - (setopt prefix-help-command #'embark-prefix-help-command) + (setq prefix-help-command #'embark-prefix-help-command) :config (add-to-list 'display-buffer-alist '("\\`\\*Embark Collect \\(Live\\|Completions\\)\\*" @@ -642,7 +649,7 @@ When at the beginning of a line, delete blank lines before point." (use-package undo-fu-session :ensure t :config - (setopt undo-fu-session-compression (cond + (setq undo-fu-session-compression (cond ((executable-find "gunzip") 'gz) ((executable-find "bzip2") 'bz2)) undo-fu-session-incompatible-files '("/COMMIT_EDITMSG\\'" @@ -667,6 +674,7 @@ When at the beginning of a line, delete blank lines before point." ([right-margin double-wheel-up] . pixel-scroll-precision) ([right-margin triple-wheel-up] . pixel-scroll-precision)) :config - (pixel-scroll-precision-mode)) + (when (fboundp 'pixel-scroll-precision-mode) + (pixel-scroll-precision-mode))) ;;; basics.el ends here diff --git a/early-init.el b/early-init.el index 4b67629..80d91db 100644 --- a/early-init.el +++ b/early-init.el @@ -34,6 +34,8 @@ (package-initialize) (unless package-archive-contents (package-refresh-contents)) +(unless (package-installed-p 'use-package) + (package-install 'use-package)) (setq use-package-enable-imenu-support t use-package-hook-name-suffix nil) @@ -47,10 +49,10 @@ (when (memq :ensure body) (add-to-list 'package-selected-packages name))) -(use-package use-package-vc - :load-path "~/src/emacs/use-package-vc.el/" - :config - (define-advice package-vc-install (:around (orig &rest args) wtf) - "Don't freak out about `package-archives' shit." - (let ((package-archives nil)) - (apply orig args)))) +;; (use-package use-package-vc +;; :load-path "~/src/emacs/use-package-vc.el/" +;; :config +;; (define-advice package-vc-install (:around (orig &rest args) wtf) +;; "Don't freak out about `package-archives' shit." +;; (let ((package-archives nil)) +;; (apply orig args)))) diff --git a/init.el b/init.el index d6363ea..707125e 100644 --- a/init.el +++ b/init.el @@ -21,52 +21,52 @@ (use-package emacs ; Misc. config :config - (setopt recenter-positions '(top middle bottom) - initial-major-mode 'lisp-interaction-mode - initial-scratch-message ";; Emacs!\n\n" - ;; (format "%s\n\n" - ;; (mapconcat (lambda (s) (format ";; %s" s)) - ;; (process-lines "fortune" "-s") - ;; "\n")) - eval-expression-print-level nil - eval-expression-print-length nil - x-select-enable-clipboard-manager nil) + (setq recenter-positions '(top middle bottom) + initial-major-mode 'lisp-interaction-mode + initial-scratch-message ";; Emacs!\n\n" + ;; (format "%s\n\n" + ;; (mapconcat (lambda (s) (format ";; %s" s)) + ;; (process-lines "fortune" "-s") + ;; "\n")) + eval-expression-print-level nil + eval-expression-print-length nil + x-select-enable-clipboard-manager nil) ;; TODO: move this ... elsewhere - (setopt mode-line-format - '("%e" - mode-line-front-space - ;; (:propertize ("" mode-line-mule-info - ;; mode-line-client - ;; mode-line-modified - ;; mode-line-remote) - ;; display (min-width (5.0))) - ("" mode-line-mule-info - mode-line-client - mode-line-modified - mode-line-remote) - mode-line-frame-identification - mode-line-buffer-identification - " " - mode-line-position - (vc-mode vc-mode) - " " - minions-mode-line-modes - mode-line-misc-info - mode-line-end-spaces)) + (setq mode-line-format + '("%e" + mode-line-front-space + ;; (:propertize ("" mode-line-mule-info + ;; mode-line-client + ;; mode-line-modified + ;; mode-line-remote) + ;; display (min-width (5.0))) + ("" mode-line-mule-info + mode-line-client + mode-line-modified + mode-line-remote) + mode-line-frame-identification + mode-line-buffer-identification + " " + mode-line-position + (vc-mode vc-mode) + " " + minions-mode-line-modes + mode-line-misc-info + mode-line-end-spaces)) (keymap-global-unset "C-\\") (keymap-global-unset "") (setf (alist-get "\\*Compile-Log\\*" display-buffer-alist nil nil #'equal) '(display-buffer-no-window)) - (add-hook 'after-init-hook - (defun global-mode-string@setup () - (defvar jabber-activity-mode-string) - (defvar org-mode-line-string) - (defvar display-time-mode) - (defvar display-time-string) - (setf global-mode-string - '((t jabber-activity-mode-string) - org-mode-line-string - (display-time-mode display-time-string))))) + ;; (add-hook 'after-init-hook + ;; (defun global-mode-string@setup () + ;; (defvar jabber-activity-mode-string) + ;; (defvar org-mode-line-string) + ;; (defvar display-time-mode) + ;; (defvar display-time-string) + ;; (setf global-mode-string + ;; '((t jabber-activity-mode-string) + ;; org-mode-line-string + ;; (display-time-mode display-time-string))))) (keymap-global-set "C-c t" (define-keymap :prefix 'toggle-map @@ -87,23 +87,22 @@ "Recursive Mono Casual Static" "Comic Code" "DejaVu Sans Mono") - :height 100))) + :height 110))) (face-spec-set 'fixed-pitch `((t :family ,(find-font - "Recursive Mono Casual Static" + "Recursive Mono Linear Static" "Comic Code" "DejaVu Sans Mono") :height 1.0))) (face-spec-set 'variable-pitch `((t :family ,(find-font - "Recursive Sans Linear Static" + "Recursive Sans Casual Static" "Atkinson Hyperlegible" "DejaVu Serif") :height 1.0))) (face-spec-set 'font-lock-comment-face - `((t :inherit variable-pitch))) - (face-spec-set 'font-lock-string-face - `((t :inherit variable-pitch))) + `((t :slant italic + :inherit variable-pitch))) ;; Emojis (cl-loop with ffl = (font-family-list) for font in '("Noto Emoji" "Noto Color Emoji" @@ -147,8 +146,11 @@ (use-package prog-mode :config - (setopt tab-width 8 - sh-indentation tab-width) + ;;; TABS + (setq tab-width 8 + sh-indentation tab-width + ) + ;;; Hooks (add-hook 'prog-mode-hook #'auto-fill-mode) (add-hook 'prog-mode-hook (defun prog@indent-tabs-maybe () @@ -158,11 +160,12 @@ 'scheme-mode 'python-mode 'haskell-mode) - -1 1))))) + -1 1)))) + (global-prettify-symbols-mode)) (use-package auth-source :config - (setopt auth-sources '(default "secrets:passwords")) + (setq auth-sources '(default "secrets:passwords")) (add-hook 'auth-info-hook #'truncate-lines-local-mode)) (use-package fringe @@ -171,7 +174,7 @@ (use-package ispell :config - (setopt ispell-program-name (choose-executable "aspell" "ispell")) + (setq ispell-program-name (choose-executable "aspell" "ispell")) ;; (add-hook 'before-save-hook ;; #'+ispell-move-buffer-words-to-dir-locals-hook) (put 'ispell-buffer-session-localwords 'safe-local-variable @@ -185,23 +188,23 @@ ("" . dired-up-directory)) :config (require 'dired-x) - (setopt dired-recursive-copies 'always - dired-recursive-deletes 'always - dired-create-destination-dirs 'always - dired-do-revert-buffer t - dired-hide-details-hide-symlink-targets nil - dired-isearch-filenames 'dwim - delete-by-moving-to-trash t - dired-auto-revert-buffer t - dired-listing-switches "-AlFhv --group-directories-first" - ls-lisp-dirs-first t - dired-ls-F-marks-symlinks t - dired-clean-confirm-killing-deleted-buffers nil - dired-no-confirm '(byte-compile - load chgrp chmod chown - copy move hardlink symlink - shell touch) - dired-dwim-target t) + (setq dired-recursive-copies 'always + dired-recursive-deletes 'always + dired-create-destination-dirs 'always + dired-do-revert-buffer t + dired-hide-details-hide-symlink-targets nil + dired-isearch-filenames 'dwim + delete-by-moving-to-trash t + dired-auto-revert-buffer t + dired-listing-switches "-AlFhv --group-directories-first" + ls-lisp-dirs-first t + dired-ls-F-marks-symlinks t + dired-clean-confirm-killing-deleted-buffers nil + dired-no-confirm '(byte-compile + load chgrp chmod chown + copy move hardlink symlink + shell touch) + dired-dwim-target t) (add-hook 'dired-mode-hook #'dired-hide-details-mode) (add-hook 'dired-mode-hook #'hl-line-mode) (add-hook 'dired-mode-hook #'truncate-lines-local-mode)) @@ -226,43 +229,68 @@ (use-package mouse :config - (setopt context-menu-functions '(context-menu-undo - context-menu-region - context-menu-middle-separator - context-menu-local - context-menu-minor)) + (setq context-menu-functions '(context-menu-undo + context-menu-region + context-menu-middle-separator + context-menu-local + context-menu-minor)) (context-menu-mode)) (use-package password-cache :config - (setopt password-cache t - password-cache-expiry 3600)) + (setq password-cache t + password-cache-expiry 3600)) (use-package time :config - (setopt display-time-format " %H:%M" - display-time-interval 60 - display-time-use-mail-icon t - display-time-mail-function - (defun +notmuch-new-mail-p () - (plist-get (cl-find "inbox+unread" - (ignore-errors - (notmuch-hello-query-counts notmuch-saved-searches)) - :key (lambda (l) (plist-get l :name)) - :test #'equal) - :count)) - display-time-default-load-average nil) + (setq display-time-format " %H:%M" + display-time-interval 60 + display-time-use-mail-icon t + display-time-mail-function + (defun +notmuch-new-mail-p () + (plist-get (cl-find "inbox+unread" + (ignore-errors + (notmuch-hello-query-counts notmuch-saved-searches)) + :key (lambda (l) (plist-get l :name)) + :test #'equal) + :count)) + display-time-default-load-average nil) (with-eval-after-load 'notmuch (add-hook 'notmuch-after-tag-hook #'display-time-update)) - (display-time-mode)) + ;; (display-time-mode) + ) (use-package tab-bar :config - (setopt tab-bar-show t - tab-bar-close-button-show t) - ;; (add-to-list 'tab-bar-format 'tab-bar-format-menu-bar) - (add-to-list 'tab-bar-format 'tab-bar-format-align-right :append) - (add-to-list 'tab-bar-format 'tab-bar-format-global :append) + (setq tab-bar-show t + tab-bar-close-button-show t) + (setopt tab-bar-format + `(tab-bar-format-history + tab-bar-format-tabs + tab-bar-separator + tab-bar-format-add-tab + tab-bar-format-align-right + ,(defun tab-bar-extra-info () + `((global menu-item + ,(format-mode-line + '((jabber-activity-mode jabber-activity-mode-string) + (:eval (when (and (fboundp 'org-clocking-p) + (org-clocking-p)) + (format " %s" + (truncate-string-to-width + org-mode-line-string + 16 + nil + nil + (truncate-string-ellipsis))))) + (:eval (tmr-mode-line)) + (display-time-mode + (:eval (format " %s" (string-trim display-time-string)))) + ("" " "))) + ignore)))) + mode-line-misc-info (cl-delete-if (lambda (x) + (eq (car x) 'global-mode-string)) + mode-line-misc-info)) (if (daemonp) (add-hook 'server-after-make-frame-hook (defun after-frame@tab-bar () @@ -306,7 +334,7 @@ (use-package eldoc :config - (setopt eldoc-documentation-strategy #'eldoc-documentation-compose-eagerly) + (setq eldoc-documentation-strategy #'eldoc-documentation-compose-eagerly) (setf (alist-get "^\\*eldoc for" display-buffer-alist nil nil #'equal) '(display-buffer-at-bottom (window-height . 4))) @@ -314,15 +342,15 @@ (use-package pulse :config - (setopt pulse-flag nil - pulse-delay 1 - pulse-iterations 1)) + (setq pulse-flag nil + pulse-delay 1 + pulse-iterations 1)) (use-package flyspell :hook (org-mode-hook)) -(use-package display-fill-column-indicator - :hook (prog-mode-hook)) +;; (use-package display-fill-column-indicator +;; :hook (prog-mode-hook)) (use-package package :config @@ -382,6 +410,23 @@ See `inferior-emacs-lisp-mode' for details." (add-hook 'ielm-mode-hook #'+ielm-init-history) (advice-add 'ielm-send-input :after #'+ielm-write-history)) +(use-package elec-pair + :config + (setopt electric-pair-skip-whitespace 'chomp) + (electric-pair-mode)) + +(use-package bookmark + :config + (setopt bookmark-save-flag 1)) + +(use-package sh-script + :config + (sh-electric-here-document-mode -1)) + +(use-package cc-mode + :config + (setopt c-basic-offset 8)) + ;;; Applications @@ -413,7 +458,7 @@ See `inferior-emacs-lisp-mode' for details." (use-package +scratch :load-path "lisp/" :config - (setopt +scratch-save-dir (sync/ "emacs/scratch.d/" t)) + (setq +scratch-save-dir (sync/ "emacs/scratch.d/" t)) (add-hook 'kill-buffer-query-functions #'+scratch@immortal) (add-hook 'kill-emacs-hook #'+scratch-save-on-exit) (with-current-buffer (get-scratch-buffer-create) @@ -424,21 +469,14 @@ See `inferior-emacs-lisp-mode' for details." (run-at-time t (* 60 60 24) #'+scratch-clean)) (use-package pulse-location - :load-path "~/src/emacs/pulse-location/" + :load-path "~/src/pulse-location.el/" :config (pulse-location-mode)) -(use-package dawn - :load-path "~/src/emacs/dawn/" - :after custom-allowed +(use-package emacs ; `modus-themes' isn't a package ... :config - (add-hook 'custom-allowed-after-load-hook - (defun dawn-modus () - (dawn-schedule-themes 'modus-operandi - 'modus-vivendi))) (setopt modus-themes-mixed-fonts t) - (load-theme 'modus-vivendi t) - (add-hook 'dawn-after-load-theme-hook + (add-hook 'modus-themes-after-load-theme-hook (defun +reset-faces () (dolist (face '(font-lock-regexp-face font-lock-variable-name-face @@ -469,23 +507,28 @@ See `inferior-emacs-lisp-mode' for details." :weight bold))) (face-spec-set 'font-lock-doc-face '((t :slant italic))))) - (+reset-faces)) + (add-hook 'after-init-hook + (defun modus@load () + (+reset-faces) + (pcase (string-trim (shell-command-to-string "darkman get")) + ("light" (load-theme 'modus-operandi t)) + ("dark" (load-theme 'modus-vivendi t)))))) (use-package electric-cursor - :load-path "~/src/emacs/electric-cursor/" + :load-path "~/src/electric-cursor.el/" :config - (setopt electric-cursor-alist '((overwrite-mode . box) - (t . bar))) + (setq electric-cursor-alist '((overwrite-mode . box) + (t . bar))) (electric-cursor-mode)) (use-package mode-line-bell - :load-path "~/src/emacs/mode-line-bell/" + :load-path "~/src/mode-line-bell.el/" :config - (setopt mode-line-bell-flash-time 0.25) + (setq mode-line-bell-flash-time 0.25) (mode-line-bell-mode)) (use-package titlecase - :load-path "~/src/emacs/titlecase.el/" + :load-path "~/src/titlecase.el/" :preface (defun +titlecase-sentence-style-dwim (&optional arg) "Titlecase a sentence. @@ -515,7 +558,7 @@ With prefix ARG, toggle the value of (keymap-set scule-map "M-t" #'titlecase-dwim))) (use-package scule - :load-path "~/src/emacs/scule/" + :load-path "~/src/scule.el/" :bind-keymap ("M-c" . scule-map) :init ;; Use M-u for prefix keys @@ -523,23 +566,23 @@ With prefix ARG, toggle the value of (keymap-set universal-argument-map "M-u" #'universal-argument-more)) (use-package filldent - :load-path "~/src/emacs/filldent/" + :load-path "~/src/filldent.el/" :bind ("M-q" . filldent-dwim) :config - (setopt filldent-fill-modes '(web-mode))) + (setq filldent-fill-modes '(web-mode))) (use-package frowny - :load-path "~/src/emacs/frowny/" + :load-path "~/src/frowny.el/" :config (global-frowny-mode)) (use-package keepassxc-shim - :load-path "~/src/emacs/keepassxc-shim/" + :load-path "~/src/keepassxc-shim.el/" :config (keepassxc-shim-activate)) (use-package hippie-completing-read - :load-path "~/src/emacs/hippie-completing-read/" + :load-path "~/src/hippie-completing-read.el/" :bind (("M-/" . hippie-completing-read))) @@ -549,7 +592,7 @@ With prefix ARG, toggle the value of :ensure t :config ;; https://github.com/jwiegley/emacs-async/issues/64 - ;; (setopt message-send-mail-function #'async-smtpmail-send-it) + ;; (setq message-send-mail-function #'async-smtpmail-send-it) (dired-async-mode) (async-bytecomp-package-mode)) @@ -560,11 +603,11 @@ With prefix ARG, toggle the value of :ensure t :hook (prog-mode-hook)) -(use-package clean-kill-ring - :vc (:url "https://github.com/NicholasBHubbard/clean-kill-ring.el") - :config - (setopt clean-kill-ring-prevent-duplicates t) - (clean-kill-ring-mode)) +;; (use-package clean-kill-ring +;; :vc (:url "https://github.com/NicholasBHubbard/clean-kill-ring.el") +;; :config +;; (setq clean-kill-ring-prevent-duplicates t) +;; (clean-kill-ring-mode)) (use-package minions :ensure t @@ -641,7 +684,7 @@ The prefix argument is as in `visual-fill-column-widen' but negated." (use-package wgrep :ensure t :config - (setopt wgrep-enable-key (kbd "C-x C-q")) + (setq wgrep-enable-key (kbd "C-x C-q")) :bind (:map grep-mode-map ("C-x C-q" . wgrep-change-to-wgrep-mode))) @@ -651,8 +694,8 @@ The prefix argument is as in `visual-fill-column-widen' but negated." :map isearch-mode-map ("M-j" . avy-isearch)) :config - (setopt avy-background t - avy-keys (string-to-list "asdfghjklqwertyuiopzxcvbnm"))) + (setq avy-background t + avy-keys (string-to-list "asdfghjklqwertyuiopzxcvbnm"))) (use-package zzz-to-char :ensure t @@ -666,11 +709,11 @@ The prefix argument is as in `visual-fill-column-widen' but negated." (use-package isearch-mb :ensure t :config - (setopt isearch-lazy-count t - isearch-regexp-lax-whitespace t - search-whitespace-regexp "\\W+" - search-default-mode t ; Search regexp by default - isearch-wrap-pause 'no) + (setq isearch-lazy-count t + isearch-regexp-lax-whitespace t + search-whitespace-regexp "\\W+" + search-default-mode t ; Search regexp by default + isearch-wrap-pause 'no) (define-advice isearch-cancel (:before (&rest _) add-search-to-history) "Add search string to history when canceling." (unless (equal "" isearch-string) @@ -702,46 +745,46 @@ The prefix argument is as in `visual-fill-column-widen' but negated." "C-M-%" #'anzu-isearch-query-replace) (isearch-mb-mode)) -(use-package paredit - :ensure t - :hook ( emacs-lisp-mode-hook ielm-mode-hook - eval-expression-minibuffer-setup-hook - lisp-interaction-mode-hook - lisp-mode-hook scheme-mode-hook - fennel-mode-hook fennel-repl-mode-hook - geiser-mode-hook geiser-repl-mode-hook) - :config - (keymap-set paredit-mode-map "C-j" - (defun +paredit-newline () - (interactive) - (call-interactively - (if (derived-mode-p 'lisp-interaction-mode) - #'eval-print-last-sexp #'paredit-newline)))) - (keymap-unset paredit-mode-map "RET" t) - (keymap-unset paredit-mode-map "M-s" t) - (keymap-unset paredit-mode-map "M-r" t) - (add-to-list 'paredit-space-for-delimiter-predicates - (defun paredit@dont-space-@ (endp delimiter) - "Don't add a space after @ in `paredit-mode'." - (let ((point (point))) - (or endp - (seq-every-p - (lambda (prefix) - (and (> point (length prefix)) - (let ((start (- point (length prefix))) - (end point)) - (not (string= (buffer-substring start end) - prefix))))) - ;; Add strings to this list to inhibit adding a space - ;; after them. - '(",@"))))))) +;; (use-package paredit +;; :ensure t +;; :hook ( emacs-lisp-mode-hook ielm-mode-hook +;; eval-expression-minibuffer-setup-hook +;; lisp-interaction-mode-hook +;; lisp-mode-hook scheme-mode-hook +;; fennel-mode-hook fennel-repl-mode-hook +;; geiser-mode-hook geiser-repl-mode-hook) +;; :config +;; (keymap-set paredit-mode-map "C-j" +;; (defun +paredit-newline () +;; (interactive) +;; (call-interactively +;; (if (derived-mode-p 'lisp-interaction-mode) +;; #'eval-print-last-sexp #'paredit-newline)))) +;; (keymap-unset paredit-mode-map "RET" t) +;; (keymap-unset paredit-mode-map "M-s" t) +;; (keymap-unset paredit-mode-map "M-r" t) +;; (add-to-list 'paredit-space-for-delimiter-predicates +;; (defun paredit@dont-space-@ (endp delimiter) +;; "Don't add a space after @ in `paredit-mode'." +;; (let ((point (point))) +;; (or endp +;; (seq-every-p +;; (lambda (prefix) +;; (and (> point (length prefix)) +;; (let ((start (- point (length prefix))) +;; (end point)) +;; (not (string= (buffer-substring start end) +;; prefix))))) +;; ;; Add strings to this list to inhibit adding a space +;; ;; after them. +;; '(",@"))))))) (use-package hungry-delete :ensure t :config - (setopt hungry-delete-chars-to-skip " \t" - hungry-delete-skip-regexp (format "[%s]" hungry-delete-chars-to-skip) - hungry-delete-join-reluctantly nil) + (setq hungry-delete-chars-to-skip " \t" + hungry-delete-skip-regexp (format "[%s]" hungry-delete-chars-to-skip) + hungry-delete-join-reluctantly nil) (add-to-list 'hungry-delete-except-modes 'eshell-mode) (add-to-list 'hungry-delete-except-modes 'nim-mode) (add-to-list 'hungry-delete-except-modes 'python-mode) @@ -758,9 +801,9 @@ The prefix argument is as in `visual-fill-column-widen' but negated." (interactive "*p") (if (looking-at hungry-delete-skip-regexp) (hungry-delete-forward (or arg 1)) - (paredit-forward-delete arg)))) - ;; Mode - (global-hungry-delete-mode))) + (paredit-forward-delete arg))))) + ;; Mode + (global-hungry-delete-mode)) (use-package macrostep :ensure t @@ -777,7 +820,7 @@ The prefix argument is as in `visual-fill-column-widen' but negated." :ensure t :when inferior-lisp-program :preface - (setopt inferior-lisp-program (choose-executable "sbcl")) + (setq inferior-lisp-program (choose-executable "sbcl")) (defun +sly-start-or-mrepl () (interactive) (if (ignore-errors (sly-connection)) @@ -787,7 +830,7 @@ The prefix argument is as in `visual-fill-column-widen' but negated." :config (autoload 'sly-mrepl "sly-mrepl" nil t) (keymap-set sly-mode-map "C-c C-z" #'+sly-start-or-mrepl) - (setopt sly-net-coding-system 'utf-8-unix) + (setq sly-net-coding-system 'utf-8-unix) (sly-symbol-completion-mode -1)) (use-package pdf-tools @@ -825,9 +868,9 @@ The prefix argument is as in `visual-fill-column-widen' but negated." :ensure t :mode "\\.\\(?:md\\|markdown\\|mkd\\|mdown\\|mkdn\\|mdwn\\)\\'" :config - (setopt markdown-command (choose-executable - '("pandoc" "--from=markdown" "--to=html5") - "markdown")) + (setq markdown-command (choose-executable + '("pandoc" "--from=markdown" "--to=html5") + "markdown")) (add-hook 'markdown-mode-hook #'visual-fill-column-mode)) (use-package pandoc-mode @@ -864,31 +907,44 @@ The prefix argument is as in `visual-fill-column-widen' but negated." :bind (("C-c r p" . eradio-toggle|play) ("C-c r s" . eradio-stop)) :config - (setopt eradio-player '("mpv" "--no-video" "--no-terminal") - eradio-channels - ;; At some point I should actually ... write this in to this file or - ;; something. But until I decide to quit using radish altogether, this - ;; what I got. - (with-current-buffer (find-file-noselect "~/etc/radish/stations") - (let (chans) - (dolist (line (string-split (buffer-substring-no-properties - (point-min) (point-max)) - "\n") - chans) - (unless (string-match-p "^#" line) - (let* ((ll (string-split line "\t")) - (url (cl-first ll)) - (name (cl-second ll)) - (tags (cl-third ll))) - (when (and name - (string-match-p "[^ \n\t]*://[^ \n\t]*" url)) - (push (cons (format "%s - %s" name tags) url) chans))))))))) + (setq eradio-player '("mpv" "--no-video" "--no-terminal") + eradio-channels + ;; (name . url) + '(("Nightwave Plaza" . "http://radio.plaza.one/ogg") + ("Radio Paradise - Main Mix" . + "http://stream.radioparadise.com/rp_192m.ogg") + ("Radio Paradise - Mellow Mix" . + "http://stream.radioparadise.com/mellow-96m.ogg") + ("Radio Paradise - Rock Mix" . + "http://stream.radioparadise.com/rock-96m.ogg") + ("Radio Paradise - Global Mix" . + "http://stream.radioparadise.com/global-96m.ogg") + ("KLSU" . "http://130.39.238.143:8010/stream.mp3")) + ;; At some point I should actually ... write this in to this file or + ;; something. But until I decide to quit using radish altogether, this + ;; what I got. + ;; (with-current-buffer (find-file-noselect "~/etc/radish/stations") + ;; (let (chans) + ;; (dolist (line (string-split (buffer-substring-no-properties + ;; (point-min) (point-max)) + ;; "\n") + ;; chans) + ;; (unless (string-match-p "^#" line) + ;; (let* ((ll (string-split line "\t")) + ;; (url (cl-first ll)) + ;; (name (cl-second ll)) + ;; (tags (cl-third ll))) + ;; (when (and name + ;; (string-match-p "[^ \n\t]*://[^ \n\t]*" url)) + ;; (push (cons (format "%s - %s" name tags) url) + ;; chans))))))) + )) (use-package wiki-abbrev :after org ; Don't need abbrevs til I load org. - :load-path "~/src/emacs/wiki-abbrev.el/" + :load-path "~/src/wiki-abbrev.el/" :config - (setopt wiki-abbrev-file (etc/ "wiki-abbrevs")) + (setq wiki-abbrev-file (etc/ "wiki-abbrevs")) (wiki-abbrev-insinuate)) (use-package flyspell-correct @@ -931,7 +987,7 @@ With PREFIX, prompt to change the current dictionary." :bind (:map dired-mode-map (")" . dired-git-info-mode)) :config - (setopt dgi-auto-hide-details-p nil)) + (setq dgi-auto-hide-details-p nil)) (use-package expand-region ; needed for embrace anyway :ensure t @@ -963,7 +1019,7 @@ With PREFIX, prompt to change the current dictionary." (keymap-set org-mode-map "=" (org-insert-or-embrace "=")) (keymap-set org-mode-map "~" (org-insert-or-embrace "~")) (keymap-set org-mode-map "+" (org-insert-or-embrace "+"))) - :bind (("C-\"" . embrace-commander)) + :bind (("C-'" . embrace-commander)) :hook ((org-mode-hook . embrace-org-mode-hook) (ruby-mode-hook . embrace-ruby-mode-hook) (emacs-lisp-mode-hook . embrace-emacs-lisp-mode-hook) @@ -972,7 +1028,7 @@ With PREFIX, prompt to change the current dictionary." (use-package apheleia :ensure t :config - (setopt apheleia-hide-log-buffers t) + (setq apheleia-hide-log-buffers t) (setf (alist-get 'shfmt apheleia-formatters) '("shfmt" "--case-indent")) (global-set-key (kbd "M-C-\\") @@ -997,44 +1053,24 @@ With PREFIX, prompt to change the current dictionary." (use-package rec-mode :ensure t) -;; (use-package gauche-mode -;; :load-path "~/src/emacs/gauche-mode/" -;; :mode "\\.scm\\'" -;; :config -;; (setopt gauche-mode-info-language 'en -;; scheme-program-name "gosh -i" -;; scheme-compile-exp-command "%s") -;; (add-to-list 'scheme-source-modes 'gauche-mode) -;; (setf (alist-get "\\*scheme\\*" display-buffer-alist nil nil #'equal) -;; '((display-buffer-reuse-window -;; display-buffer-pop-up-window) -;; (inhibit-same-window . t))) -;; (add-hook 'gauche-mode-hook #'enable-gauche-paredit-mode) -;; (add-hook 'inferior-scheme-mode-hook #'enable-gauche-paredit-mode) -;; ;; Extras -;; (define-key gauche-mode-map (kbd "C-c C-k") -;; (defun +gauche-mode-send-buffer () -;; (interactive) -;; (save-mark-and-excursion -;; (let ((start (point-min)) -;; (end (point-max))) -;; (goto-char start) -;; (while (or (looking-at "#!") ; Shebang -;; (looking-at ":;") ; "shell trampoline" -;; ) -;; (forward-line 1) -;; (beginning-of-line) -;; (setq start (point))) -;; (scheme-send-region-and-go start end)))))) (use-package geiser :ensure t :config - (use-package geiser-guile :ensure t) - (use-package geiser-chicken :ensure t) - (use-package geiser-chez :ensure t) - (use-package geiser-gambit :ensure t) - (use-package geiser-chibi :ensure t) + (when (executable-find "guile") + (use-package geiser-guile :ensure t)) + (when (executable-find "chicken") + (use-package geiser-chicken :ensure t)) + (when (or (prog1 (executable-find "chez") + (setopt geiser-chez-binary + (executable-find "chez"))) + (executable-find "petite") + (executable-find "scheme")) + (use-package geiser-chez :ensure t)) + (when (executable-find "gambit") + (use-package geiser-gambit :ensure t)) + (when (executable-find "chibi-scheme") + (use-package geiser-chibi :ensure t)) (use-package macrostep-geiser :ensure t :config @@ -1047,21 +1083,6 @@ With PREFIX, prompt to change the current dictionary." (keymap-unset geiser-mode-map "C-." t) (keymap-unset scheme-mode-map "M-o" t))) -(use-package treesit-auto - ;; XXX: I don't really get the utility of this package, but I spent a ton of - ;; time figuring out how to properly build it ... so here it is. - :ensure t - :when (treesit-available-p) - :config - ;; (setopt treesit-extra-load-path - ;; ;; https://github.com/casouri/tree-sitter-module/ - ;; `(,(expand-file-name "~/misc/tree-sitter-module/dist/"))) - (setopt treesit-auto-install nil) ; javascript keeps failing - (global-treesit-auto-mode)) - -(use-package elpher - :ensure t) - (use-package detached :when (executable-find "dtach") :ensure t @@ -1078,33 +1099,33 @@ With PREFIX, prompt to change the current dictionary." (use-package lin :ensure t :config - (setopt lin-face 'lin-cyan - lin-mode-hooks - '(dired-mode-hook - ;; bongo-mode-hook - ;; elfeed-search-mode-hook - git-rebase-mode-hook - grep-mode-hook - ibuffer-mode-hook - ilist-mode-hook - ;; ledger-report-mode-hook - log-view-mode-hook - magit-log-mode-hook - ;; mu4e-headers-mode-hook - notmuch-search-mode-hook - notmuch-tree-mode-hook - occur-mode-hook - org-agenda-mode-hook - pdf-outline-buffer-mode-hook - proced-mode-hook - tabulated-list-mode-hook)) + (setq lin-face 'lin-cyan + lin-mode-hooks + '(dired-mode-hook + ;; bongo-mode-hook + ;; elfeed-search-mode-hook + git-rebase-mode-hook + grep-mode-hook + ibuffer-mode-hook + ilist-mode-hook + ;; ledger-report-mode-hook + log-view-mode-hook + magit-log-mode-hook + ;; mu4e-headers-mode-hook + notmuch-search-mode-hook + notmuch-tree-mode-hook + occur-mode-hook + org-agenda-mode-hook + pdf-outline-buffer-mode-hook + proced-mode-hook + tabulated-list-mode-hook)) (lin-global-mode)) (use-package gcmh :ensure t :config - (setopt gcmh-idle-delay 'auto - gcmh-verbose nil) + (setq gcmh-idle-delay 'auto + gcmh-verbose nil) (gcmh-mode)) (use-package tmr @@ -1116,44 +1137,10 @@ With PREFIX, prompt to change the current dictionary." tmr--timers) (propertize "⏲" 'face 'font-lock-warning-face) "")) - (add-to-list 'global-mode-string - '("" (:eval (tmr-mode-line))) - 'append)) - -;; (use-package elfeed -;; :ensure t -;; :preface -;; ;; https://karthinks.com/software/lazy-elfeed/ -;; (defun elfeed-scroll-up-command (&optional arg) -;; "Scroll up or go to next feed item in Elfeed" -;; (interactive "^P") -;; (let ((scroll-error-top-bottom nil)) -;; (condition-case-unless-debug nil -;; (scroll-up-command arg) -;; (error (elfeed-show-next))))) -;; (defun elfeed-scroll-down-command (&optional arg) -;; "Scroll up or go to next feed item in Elfeed" -;; (interactive "^P") -;; (let ((scroll-error-top-bottom nil)) -;; (condition-case-unless-debug nil -;; (scroll-down-command arg) -;; (error (elfeed-show-prev))))) -;; :bind (("C-c f" . elfeed)) -;; :config -;; (setopt elfeed-enclosure-default-dir "~/var/download/" -;; elfeed-db-directory (sync/ "emacs/elfeed/db" t) -;; elfeed-curl-max-connections 4) -;; (add-hook 'elfeed-search-update-hook #'truncate-lines-local-mode) -;; (keymap-set elfeed-show-mode-map "SPC" #'elfeed-scroll-up-command) -;; (keymap-set elfeed-show-mode-map "S-SPC" #'elfeed-scroll-down-command) -;; (keymap-set elfeed-search-mode-map "a" #'elfeed-search-untag-all-unread) -;; (setq elfeed-feeds nil) ; Always reload the feed list from feeds.opml -;; (elfeed-load-opml "~/var/feeds.opml")) - -(use-package iedit ; XXX: is this necessary? - :ensure t - :init - (customize-set-variable 'iedit-toggle-key-default (kbd "C-'"))) + ;; (add-to-list 'global-mode-string + ;; '("" (:eval (tmr-mode-line))) + ;; 'append) + ) (use-package dumb-jump :ensure t diff --git a/lisp/acdw-chat.el b/lisp/acdw-chat.el index 62dcf72..9294ffe 100644 --- a/lisp/acdw-chat.el +++ b/lisp/acdw-chat.el @@ -51,6 +51,16 @@ CHANNEL, SERVER, NICK, and BIBOUMI-SERVER are passed to nick 'popup)))) +(defalias 'jabber-irc-join 'jabber-biboumi-muc-connect) + +(defun jabber-connect-all* (&optional arg) + "Run `jabber-connect-all'. +With a prefix ARG, disconnect first." + (interactive "p") + (when arg + (jabber-disconnect)) + (jabber-connect-all)) + (defun jabber-group-yank-join-url () "Yank a url for joining the focused group." (interactive) @@ -62,7 +72,7 @@ CHANNEL, SERVER, NICK, and BIBOUMI-SERVER are passed to ;;; Packages (use-package jabber - :load-path "~/src/emacs/jabber/" + :load-path "~/src/jabber.el/" :custom-face (jabber-activity-face ((t :inherit jabber-chat-prompt-foreign :foreground unspecified @@ -85,37 +95,58 @@ CHANNEL, SERVER, NICK, and BIBOUMI-SERVER are passed to :bind-keymap ("C-c j" . jabber-global-keymap) :bind (("C-c C-SPC" . jabber-activity-switch-to)) :config - (setopt jabber-account-list '(("acdw@hmm.st")) - jabber-auto-reconnect t - jabber-biboumi-server "irc.hmm.st" - jabber-biboumi-irc-servers '("irc.libera.chat" - "irc.tilde.chat" - "tilde.town" - "m455.casa" - "irc.twitch.tv") - jabber-biboumi-default-nick "acdw" - jabber-last-read-marker (make-string fill-column ?.) - jabber-muc-decorate-presence-patterns - '(("\\( enters the room ([^)]+)\\| has left the chatroom\\)$" . nil) - ("Mode #.*" . jabber-muc-presence-dim) - ("." . jabber-muc-presence-dim)) - jabber-activity-make-strings #'jabber-activity-make-strings-shorten - jabber-rare-time-format " - - - - - - %H:%M %F" - jabber-muc-header-line-format - '(" " (:eval (replace-regexp-in-string "%" "%%" - (jabber-jid-displayname - jabber-group))) - " / " jabber-muc-topic) - ;; buffer name formats - jabber-chat-buffer-format "*xmpp* %n" - jabber-browse-buffer-format "*xmpp-browse* %n" - jabber-groupchat-buffer-format "*xmpp-muc* %n" - jabber-muc-private-buffer-format "*xmpp-muc-private* %n" - ;; "prompt" (speaker) formats - jabber-groupchat-prompt-format (format "%%>%dn . " jabber-prefix-width) - jabber-chat-local-prompt-format (format "%%>%dn . " jabber-prefix-width) - jabber-chat-foreign-prompt-format (format "%%>%dn . " jabber-prefix-width) - jabber-muc-private-foreign-prompt-format "\n%g/%n . ") + (setq jabber-account-list '(("acdw@hmm.st")) + jabber-auto-reconnect t + jabber-biboumi-server "irc.hmm.st" + jabber-biboumi-irc-servers '("irc.libera.chat" + "irc.oftc.net" + "irc.tilde.chat" + "tilde.town" + "m455.casa" + "irc.twitch.tv") + jabber-biboumi-default-nick "acdw" + jabber-last-read-marker (make-string fill-column ?.) + jabber-muc-decorate-presence-patterns + '(("\\( enters the room ([^)]+)\\| has left the chatroom\\)$" . nil) + ("Mode #.*" . jabber-muc-presence-dim) + ("." . jabber-muc-presence-dim)) + jabber-activity-make-strings #'jabber-activity-make-strings-shorten + jabber-rare-time-format " - - - - - - %H:%M %F" + jabber-chat-header-line-format + '("" (jabber-chat-buffer-show-avatar + (:eval + (let ((buddy (jabber-jid-symbol jabber-chatting-with))) + (jabber-propertize " " + 'display (get buddy 'avatar))))) + (:eval (replace-regexp-in-string "%" "%%" + (jabber-jid-displayname + jabber-chatting-with))) + "\t" (:eval (let ((buddy (jabber-jid-symbol jabber-chatting-with))) + (propertize + (or + (cdr (assoc (get buddy 'show) jabber-presence-strings)) + (get buddy 'show)) + 'face + (or (cdr (assoc (get buddy 'show) jabber-presence-faces)) + 'jabber-roster-user-online)))) + "\t" (:eval (jabber-fix-status (get (jabber-jid-symbol jabber-chatting-with) 'status))) + "\t" jabber-events-message + "\t" jabber-chatstates-message) + jabber-muc-header-line-format + '(" " (:eval (replace-regexp-in-string "%" "%%" + (jabber-jid-displayname + jabber-group))) + " / " jabber-muc-topic) + ;; buffer name formats + jabber-chat-buffer-format "*xmpp* %n" + jabber-browse-buffer-format "*xmpp-browse* %n" + jabber-groupchat-buffer-format "*xmpp-muc* %n" + jabber-muc-private-buffer-format "*xmpp-muc-private* %n" + ;; "prompt" (speaker) formats + jabber-groupchat-prompt-format (format "%%>%dn . " jabber-prefix-width) + jabber-chat-local-prompt-format (format "%%>%dn . " jabber-prefix-width) + jabber-chat-foreign-prompt-format (format "%%>%dn . " jabber-prefix-width) + jabber-muc-private-foreign-prompt-format "\n%g/%n . ") ;; jabber muc nick coloring ;; wgreenhous | I found 1.5 ok for saturation and 2.0 for value (modus) ;; (setopt jabber-muc-nick-value 1.0 @@ -131,6 +162,7 @@ CHANNEL, SERVER, NICK, and BIBOUMI-SERVER are passed to (map-keymap (lambda (key command) (define-key jabber-global-keymap (vector (+ key #x60)) command)) jabber-global-keymap) + (define-key jabber-global-keymap "c" #'jabber-connect-all*) (require 'jabber-httpupload nil t) (add-hook 'jabber-post-connect-hooks #'jabber-enable-carbons) (remove-hook 'jabber-alert-muc-hooks 'jabber-muc-echo) diff --git a/lisp/acdw-mail.el b/lisp/acdw-mail.el index f8111e7..bf20c9b 100644 --- a/lisp/acdw-mail.el +++ b/lisp/acdw-mail.el @@ -146,7 +146,7 @@ the saved search as well." (notmuch-poll))) (lambda (_) (message "Polling mail (async)...done")))) - ;;(user-error "Feature `async' not found!") + (user-error "Feature `async' not found!") (notmuch-poll))) ;;; https://kitchingroup.cheme.cmu.edu/blog/2015/09/04/Checking-for-email-attachments-before-you-send-email/ @@ -172,28 +172,93 @@ the saved search as well." (error "No attachment. Aborting send.")))) ;;; Process ical attachments +;; https://www.reddit.com/r/emacs/comments/8s1ion/comment/e0x5kgd/ + +(defun ical2org (&optional replace output-buffer) + "Run ical2org on contents of this buffer. +If REPLACE (interactive prefix argument), replace contents of the +buffer. If no REPLACE nor OUTPUT-BUFFER, output goes to +minibuffer." + (interactive "P") + (shell-command-on-region (point-min) (point-max) + "ical2org.awk" + output-buffer + replace + "*ical2org errors*" + 'display-errors)) + +(defun ical2org-capture () + "Run `ical2org' on this buffer, then `org-capture' the result. +Leaves current buffer as-was afterwards." + (interactive) + (let ((buf (current-buffer)) + (ics (buffer-string))) + (ical2org 'replace buf) + (mark-whole-buffer) + (org-capture nil "a") + (mark-whole-buffer) + (delete-region (point-min) (point-max)) + (insert ics))) + +(defun notmuch-ics-refile (filename header) + "Refile the current ICS buffer to FILENAME, under HEADER." + (org-refile nil nil + (list header + filename + nil + (with-current-buffer (find-file-noselect filename) + (org-find-exact-headline-in-buffer header)))) + (notmuch-ics-kill)) + +(defun notmuch-ics-kill () + "Kill the current ICS buffer and delete its file." + (let ((kill-buffer-hook nil) + (kill-buffer-query-functions nil) + (file (buffer-file-name))) + (set-buffer-modified-p nil) + (kill-buffer-and-window) + (delete-file file))) + +(defun notmuch-ics-cancel () + "Cancel saving ICS buffer." + (interactive) + (notmuch-ics-kill)) + +(define-derived-mode notmuch-save-ics-mode org-mode + "Org-mode but with a different keymap.") (defun notmuch-save-ics () + ;; XXX: this is hacky as hell "Save a .ics file in a message." (interactive) (with-current-notmuch-show-message (notmuch-foreach-mime-part (lambda (part) - (message "%S" part) (when (and (listp part) (or (equal "application/ics" (caadr part)) ;; (equal "text/calendar" (caadr part)) )) - (save-window-excursion - (let* ((filename "/tmp/notmuch.ics") - (buf (find-file-noselect filename))) - (delete-file filename) - (kill-buffer (get-file-buffer filename)) - (mm-save-part-to-file part filename) - (icalendar-import-file filename diary-file) - (kill-buffer buf))))) + (let* ((filename (format "/dev/shm/notmuch-%s.ics" + (time-convert (current-time) 'integer)))) + (mm-save-part-to-file part filename) + (message "Converting ICS to org ...") + (with-current-buffer (find-file-other-window filename) + (ical2org 'replace (current-buffer)) + (deactivate-mark) + (let ((org-mode-hook nil)) + (notmuch-save-ics-mode)) + (local-set-key (kbd "C-c C-c") + (lambda () (interactive) + (notmuch-ics-refile (sync/ "org/diary.org") "Appointments"))) + (local-set-key (kbd "C-c C-k") #'notmuch-ics-cancel) + (setq-local header-line-format + (concat "ICAL buffer. " + "Finish: `C-c C-c'. " + "Abort: `C-c C-k'.")))))) (mm-dissect-buffer t t)))) +(add-hook 'notmuch-show-hook #'notmuch-save-ics) + ;;; Fixes @@ -338,7 +403,7 @@ the saved search as well." (add-hook 'notmuch-show-mode-hook #'visual-fill-column-mode) (define-advice notmuch-bury-or-kill-this-buffer (:after (&rest _) poll-async) - (notmuch-async-poll)) + (call-process "swaymail")) (define-advice notmuch-address-selection-function (:override (prompt collection _) no-initial-input) diff --git a/lisp/acdw-org.el b/lisp/acdw-org.el index f961dda..2ec3339 100644 --- a/lisp/acdw-org.el +++ b/lisp/acdw-org.el @@ -137,19 +137,33 @@ itself. Other values of ARG will call `newline' with that ARG." ;;; Copy rich text to the keyboard + ;; Thanks to Oleh Krehel: ;; https://emacs.stackexchange.com/questions/54292/copy-results-of-org-export-directly-to-clipboard ;; So. Emacs can't do this itself because it doesn't support sending clipboard ;; or selection contents as text/html. We have to use xclip instead. +;; (defun org-to-html-to-clipboard (&rest org-export-args) +;; "Export current org buffer to HTML, then copy it to the clipboard. +;; ORG-EXPORT-ARGS are passed to `org-export-to-file'." +;; (let ((f (make-temp-file "org-html-export"))) +;; (apply #'org-export-to-file 'html f org-export-args) +;; (start-process "xclip" " *xclip*" +;; "xclip" "-verbose" "-i" f +;; "-t" "text/html" "-selection" "clipboard") +;; (message "HTML pasted to clipboard."))) + +;; Wayland version.. TODO: make it work for both (defun org-to-html-to-clipboard (&rest org-export-args) "Export current org buffer to HTML, then copy it to the clipboard. ORG-EXPORT-ARGS are passed to `org-export-to-file'." - (let ((f (make-temp-file "org-html-export"))) - (apply #'org-export-to-file 'html f org-export-args) - (start-process "xclip" " *xclip*" - "xclip" "-verbose" "-i" f - "-t" "text/html" "-selection" "clipboard") - (message "HTML pasted to clipboard."))) + (let ((buf (generate-new-buffer "*org-html-clipboard*" t))) + (apply #'org-export-to-buffer 'html buf org-export-args) + (with-current-buffer buf + (call-process-region (point-min) (point-max) + "wl-copy" nil nil nil + "-t" "text/html") + (kill-buffer-and-window)) + (message "HTML copied to clipboard."))) (defun org-subtree-to-html-to-clipboard () "Export current subtree to HTML." @@ -202,6 +216,33 @@ If LIST is non-nil, return the result as a list instead of a string." (unless (eq (char-after) ?:) ":")) (when (org-at-heading-p) (org-align-tags)))))) + +;;; Navigating headings + +(defun org-next-visible-heading-unfolding (arg) + (interactive "p") + (when (let ((pt (org-next-visible-heading arg))) + (and (buffer-narrowed-p) + (or (= (point) (point-min)) + (and pt + (= pt (point-max)))))) + (widen) + (org-next-visible-heading arg) + (org-narrow-to-subtree))) + +(defun org-previous-visible-heading-unfolding (arg) + (interactive "p") + (org-next-visible-heading-unfolding (- arg))) + +(defun org-up-heading-unfolding (arg) + (interactive "p") + (when (let ((pt (outline-up-heading arg))) + (and (buffer-narrowed-p) + (= (point) (point-min)))) + (widen) + (org-up-heading-unfolding arg) + (org-narrow-to-subtree))) + ;;; Misc. @@ -261,19 +302,20 @@ If LIST is non-nil, return the result as a list instead of a string." org-archive-mark-done t org-fold-catch-invisible-edits 'show-and-error org-clock-clocked-in-display 'mode-line - org-clock-string-limit 7 ; just the clock bit + org-clock-string-limit 0 org-clock-persist nil org-confirm-babel-evaluate nil org-cycle-separator-lines 0 org-deadline-warning-days 0 org-directory (sync/ "org/" t) org-ellipsis (or (bound-and-true-p truncate-string-ellipsis) "…") - org-emphasis-alist '(("*" org-bold) - ("/" org-italic) - ("_" org-underline) - ("=" org-verbatim) - ("~" org-code) - ("+" org-strikethrough)) + org-emphasis-alist + '(("*" org-bold) + ("/" org-italic) + ("_" org-underline) + ("=" org-verbatim) + ("~" org-code) + ("+" org-strikethrough)) org-fontify-done-headline t org-fontify-quote-and-verse-blocks t org-fontify-whole-heading-line t @@ -320,6 +362,9 @@ If LIST is non-nil, return the result as a list instead of a string." (keymap-set org-mode-map "S-" #'+org-table-copy-down|+org-return-dwim) (keymap-unset org-mode-map "C-'" t) (keymap-unset org-mode-map "C-," t) + (keymap-set org-mode-map "C-c C-n" #'org-next-visible-heading-unfolding) + (keymap-set org-mode-map "C-c C-p" #'org-previous-visible-heading-unfolding) + (keymap-set org-mode-map "C-c C-u" #'org-up-heading-unfolding) ;; Hooks (add-hook 'org-mode-hook (defun org-mode@setup () @@ -333,7 +378,8 @@ If LIST is non-nil, return the result as a list instead of a string." (add-hook 'before-save-hook (defun before-save@org-mode@before-save () (org-align-tags 'all) - (+org-hide-drawers-except-point)) + (+org-hide-drawers-except-point) + ) nil :local))) ;; Extra font-lock keywords (font-lock-add-keywords @@ -353,13 +399,15 @@ If LIST is non-nil, return the result as a list instead of a string." ("" . org-clock-in-or-out)) :config (setopt org-clock-clocked-in-display 'mode-line - global-mode-string - '((t jabber-activity-mode-string) - (:eval (when (org-clocking-p) org-mode-line-string)) - (display-time-mode display-time-string))) - (add-hook 'org-clock-in-hook (defun org-clock@remove-from-global-mode-string () - (setq global-mode-string - (delq 'org-mode-line-string global-mode-string))))) + ;; global-mode-string + ;; '((t jabber-activity-mode-string) + ;; (:eval (when (org-clocking-p) org-mode-line-string)) + ;; (display-time-mode display-time-string)) + ) + ;; (add-hook 'org-clock-in-hook (defun org-clock@remove-from-global-mode-string () + ;; (setq global-mode-string + ;; (delq 'org-mode-line-string global-mode-string)))) + ) (use-package org-agenda :bind (("C-c a" . org-agenda)) @@ -372,7 +420,7 @@ If LIST is non-nil, return the result as a list instead of a string." (800 1000 1200 1400 1600 1800 2000) " ┄┄┄┄┄ " "┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄") org-agenda-current-time-string "← now ───────────────" - org-agenda-include-diary t ; I use the org-diary features + org-agenda-include-diary nil ; I use the org-diary features org-agenda-todo-ignore-deadlines 'near org-agenda-todo-ignore-scheduled 'future org-agenda-include-deadlines t @@ -397,7 +445,8 @@ If LIST is non-nil, return the result as a list instead of a string." '("WAIT" "MCKENZIE" "RACHEL"))))) (stuck "" ((org-agenda-overriding-header "Waiting")))) ((org-agenda-files ',(list (progn (require 'chd) - (chd/ "inbox-chd.org")))))))) + (chd/ "inbox-chd.org")) + (sync/ "org/diary.org"))))))) ;; Speedup agenda generation ;; https://orgmode.org/manual/Speeding-Up-Your-Agendas.html ;; https://orgmode.org/worg/agenda-optimization.html @@ -409,7 +458,7 @@ If LIST is non-nil, return the result as a list instead of a string." (add-hook 'org-agenda-mode-hook #'truncate-lines-local-mode) (add-hook 'org-agenda-mode-hook #'hl-line-mode) (add-hook 'org-agenda-after-show-hook #'org-narrow-to-subtree) - (add-hook 'org-agenda-after-show-hook #'+org-hide-drawers-except-point) + ;; (add-hook 'org-agenda-after-show-hook #'+org-hide-drawers-except-point) (define-advice org-agenda-files (:filter-return (files) skip-regexp) "Filter some files from `org-agenda'." (when org-agenda-skip-file-regexp @@ -420,11 +469,17 @@ If LIST is non-nil, return the result as a list instead of a string." files))) files) (define-advice org-agenda (:around (orig &rest r) inhibit-hooks) - (let ((org-mode-hook nil)) + (dlet ((org-mode-hook nil)) + (apply orig r))) + (define-advice org-agenda-skip (:around (orig &rest r) fix-looking-at) + (dlet ((comment-start-skip "^\\s-*#\\(?: \\|$\\)")) (apply orig r))) + ;; (advice-remove 'org-agenda 'org-agenda@inhibit-hooks) (define-advice org-agenda-switch-to (:after (&rest _) do-hooks) (run-hooks 'org-mode-hook)) - (progress@around org-agenda-list "Building agenda")) + (progress@around org-agenda-list "Building agenda") + (with-eval-after-load 'org-agenda + (add-to-list 'org-agenda-files (sync/ "org/diary.org")))) (use-package org-capture :bind (("C-c c" . org-capture))) @@ -465,7 +520,7 @@ effect for exporting link types)." org-export-with-toc nil)) (use-package org-word-count - :load-path "~/src/emacs/org-word-count/" + :load-path "~/src/org-word-count.el/" :hook org-mode-hook) (use-package org-modern @@ -487,7 +542,7 @@ effect for exporting link types)." (use-package org-taskwise :after org - :load-path "~/src/emacs/org-taskwise/") + :load-path "~/src/org-taskwise.el/") (provide 'acdw-org) ;;; acdw-org.el ends here diff --git a/lisp/acdw-shell b/lisp/acdw-shell deleted file mode 100644 index e69de29..0000000 diff --git a/lisp/acdw-shell.el b/lisp/acdw-shell.el index 7c542aa..ce63bdc 100644 --- a/lisp/acdw-shell.el +++ b/lisp/acdw-shell.el @@ -52,8 +52,8 @@ (concat (if (= 0 eshell-last-command-status) "^_^ " ";_; ") - (abbreviate-file-name (eshell/pwd)) - (if (= (user-uid) 0) " # " " $ "))) + (abbreviate-file-name (eshell/pwd)) + (if (= (user-uid) 0) " # " " $ "))) ;;; Packages @@ -89,20 +89,20 @@ (require 'esh-module) (require 'em-smart) (require 'em-tramp) - (setopt eshell-destroy-buffer-when-process-dies t - eshell-error-if-no-glob t - eshell-hist-ignoredups t - eshell-kill-on-exit t - eshell-prefer-lisp-functions t - eshell-prefer-lisp-variables t - eshell-scroll-to-bottom-on-input 'this - eshell-banner-message "" - eshell-hist-ignoredups 'erase - eshell-history-size 512 - eshell-input-filter (lambda (input) - (or (eshell-input-filter-default input) - (eshell-input-filter-initial-space input))) - eshell-prompt-function #'acdw/eshell-prompt) + (setq eshell-destroy-buffer-when-process-dies t + eshell-error-if-no-glob t + eshell-hist-ignoredups t + eshell-kill-on-exit t + eshell-prefer-lisp-functions t + eshell-prefer-lisp-variables t + eshell-scroll-to-bottom-on-input 'this + eshell-banner-message "" + eshell-hist-ignoredups 'erase + eshell-history-size 512 + eshell-input-filter (lambda (input) + (or (eshell-input-filter-default input) + (eshell-input-filter-initial-space input))) + eshell-prompt-function #'acdw/eshell-prompt) (add-hook 'eshell-mode-hook (defun eshell-setup () (hungry-delete-mode -1) diff --git a/lisp/acdw-web.el b/lisp/acdw-web.el index 40e1a3d..3b78e4d 100644 --- a/lisp/acdw-web.el +++ b/lisp/acdw-web.el @@ -30,6 +30,7 @@ This is a good function to use in key positions in `browse-url-handlers'." (cl-loop for regexp in ',regexps if (string-match-p regexp url) return regexp))) + ;;; External URL handlers (cl-defmacro +browse-url-make-external-viewer-handler @@ -93,9 +94,8 @@ for some reason." "--cache-pause-initial=yes") :prompt "Video URL: ") -(+browse-url-make-external-viewer-handler mpv-image - :program (executable-find "mpv") - :args '("--image-display-duration=inf") +(+browse-url-make-external-viewer-handler miv + :program (executable-find "miv") :prompt "Image URL: ") ;;; External domains @@ -187,6 +187,17 @@ This function will also save `custom-file' with the updated value." (message "Saved %s" file) file))) +;;; Unfucking the internet + +(defun eww-archiveis-url (url) + "Run URL through archive.is and browse the result." + (interactive (list (plist-get eww-data :url))) + (letrec ((nonce (lambda () + (unwind-protect (eww-readable) + (remove-hook 'eww-after-render-hook nonce))))) + (add-hook 'eww-after-render-hook nonce) + (eww (format "https://archive.is/submit/?url=%s" url)))) + ;;; Packages @@ -240,7 +251,8 @@ This function will also save `custom-file' with the updated value." (define-key eww-mode-map "b" #'bookmark-set) (define-key eww-mode-map "B" #'bookmark-jump) (define-key eww-mode-map (kbd "M-n") nil) - (define-key eww-mode-map (kbd "M-p") nil)) + (define-key eww-mode-map (kbd "M-p") nil) + (define-key eww-mode-map (kbd "*") #'eww-archiveis-url)) (use-package browse-url :demand t @@ -248,6 +260,9 @@ This function will also save `custom-file' with the updated value." (put 'browse-url-browser-function 'safe-local-variable '+browse-url-browser-function-safe-p) (setopt browse-url-browser-function #'eww-browse-url + browse-url-secondary-browser-function #'browse-url-firefox + browse-url-firefox-program (executable-find "firefox") + browse-url-firefox-arguments '("--new-tab") ;; Dispatch browser based on URL browse-url-handlers `(;; Videos @@ -266,7 +281,7 @@ This function will also save `custom-file' with the updated value." (rx "." (or "jpeg" "jpg" "png" "pn" "bmp" "webp") eos)) - . +browse-url-with-mpv-image) + . +browse-url-with-miv) ;; Blobs (,(+browse-url-matches (rx "." (or ".tar.gz" ".pdf") eos)) . +browse-url-download) @@ -294,7 +309,8 @@ This function will also save `custom-file' with the updated value." browse-url-firefox-arguments '("--new-tab") browse-url-generic-program firefox browse-url-generic-args browse-url-firefox-arguments)) - (when-let ((chromium (choose-executable "chromium"))) + (when-let ((chromium (choose-executable "chromium" + "chromium-browser"))) (setopt browse-url-chromium-program chromium browse-url-generic-program chromium)) (when-let ((chrome (choose-executable "chrome" @@ -304,7 +320,7 @@ This function will also save `custom-file' with the updated value." (use-package browse-url-transform :after browse-url - :load-path "~/src/emacs/browse-url-transform/" + :load-path "~/src/browse-url-transform.el/" :config (setopt browse-url-transform-alist `(;; Privacy-respecting alternatives diff --git a/lisp/acdw.el b/lisp/acdw.el index 63291d3..b76b947 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el @@ -59,6 +59,13 @@ enables passing arguments to a calling function." ("—" "---")))) (replace-match replace nil nil))))) +(defun unsmartify-dwim () + "Unsmartify the current region or the entire buffer." + (interactive) + (if (region-active-p) + (unsmartify-region (region-beginning) (region-end)) + (unsmartify-region (point-min) (point-max)))) + (defun ++concat (func strings) "Concat STRINGS processed by FUNC. Each of STRINGS can be a bare string or a list. Strings are -- cgit 1.4.1-21-gabe81