From 9df66e96c4fa98c9b74566712116f4373b5d5c64 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Mon, 20 Feb 2023 16:19:03 -0600 Subject: apsodfiuadsfoiudsfpaoidsufpaosidufposdifuapsodifuapsodifu --- basics.el | 30 ++++++--- init.el | 198 +++++++++++++++++++++++++++++++++++++++--------------- lisp/acdw-mail.el | 24 ++++--- lisp/acdw-org.el | 42 +++++++++--- 4 files changed, 215 insertions(+), 79 deletions(-) diff --git a/basics.el b/basics.el index 68cdc2a..3905003 100644 --- a/basics.el +++ b/basics.el @@ -17,7 +17,7 @@ "Where various Emacs files are placed." :makedir) -(defdir sync/ "~/Sync/" +(defdir sync/ "~/sync/" "My Syncthing directory." :makedir) @@ -142,7 +142,7 @@ ;; Text editing (setq-default fill-column 80 - sentence-end-double-space t + sentence-end-double-space nil tab-width 8 tab-always-indent 'complete) (global-so-long-mode) @@ -295,13 +295,27 @@ N spaces." (interactive "*p") (cycle-spacing (- n))) +(defun +comment-dwim (&optional prefix) + "Comments or uncomments current line or region. +When called with PREFIX, start a comment at the end of the +current line." + (interactive "P") + (if prefix + (comment-indent) + (apply #'comment-or-uncomment-region + (if (region-active-p) + (list (region-beginning) + (region-end)) + (list (line-beginning-position) + (line-end-position)))))) + (global-set-key [remap eval-expression] #'pp-eval-expression) (global-set-key (kbd "M-o") #'other-window|switch-buffer) -(global-set-key (kbd "C-x 0") #'delete-window|bury-buffer) -(global-set-key (kbd "M-SPC") #'+cycle-spacing) +(global-set-key [remap delete-window] #'delete-window|bury-buffer) +(global-set-key [remap cycle-spacing] #'+cycle-spacing) (global-set-key (kbd "C-x C-k") #'kill-this-buffer) -(global-set-key (kbd "C-/") #'undo-only) -(global-set-key (kbd "C-?") #'undo-redo) +(global-set-key [remap comment-dwim] #'+comment-dwim) +(global-set-key [remap undo] #'undo-only) (global-set-key [f10] #'tmm-menubar) (advice-add 'tmm-add-prompt :after 'minibuffer-hide-completions) @@ -408,7 +422,7 @@ N spaces." (use-package vertico-directory :after vertico :bind (:map vertico-map - ("C-DEL" . vertico-directory-delete-word)) + ("C-" . vertico-directory-delete-word)) :hook (rfn-shadow-update-overlay-hook . vertico-directory-tidy)) (use-package vertico-mouse @@ -531,7 +545,7 @@ N spaces." (use-package orderless :ensure t :demand t :init - (setopt completion-styles '(substring orderless basic) + (setopt completion-styles '(orderless substring basic) completion-category-defaults nil completion-category-overrides '((file (styles basic partial-completion orderless))))) diff --git a/init.el b/init.el index 264378c..c8fb4e7 100644 --- a/init.el +++ b/init.el @@ -21,21 +21,39 @@ (use-package emacs ; Misc. config :config - (setopt tab-bar-show 1 - recenter-positions '(top middle bottom) + (setopt recenter-positions '(top middle bottom) initial-scratch-message (format "%s\n\n" (mapconcat (lambda (s) (format ";; %s" s)) (process-lines "fortune" "-s") "\n"))) (keymap-global-unset "C-\\") + (keymap-global-unset "") (add-hook 'kill-buffer-query-functions (defun scratch@immortal () (if (equal (buffer-name) "*scratch*") (progn (bury-buffer) nil) t))) (setf (alist-get "\\*Compile-Log\\*" display-buffer-alist nil nil #'equal) - '(display-buffer-no-window))) + '(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))))) + (keymap-global-set "C-c t" + (define-keymap + :prefix 'toggle-map + "e" #'toggle-debug-on-error + "q" #'toggle-debug-on-quit + "c" #'column-number-mode + "l" #'line-number-mode + "L" #'display-line-numbers-mode))) (use-package faces :config @@ -123,7 +141,7 @@ (use-package ispell :config - (setopt ispell-program-name (choose-executable "ispell" "aspell")) + (setopt 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 @@ -227,6 +245,34 @@ ("w" . Info-copy-current-node-name-0) ("c" . Info-copy-current-node-name))) +(use-package make-mode + :defer t + :config + (add-hook 'makefile-mode-hook + (defun make-mode@setup () + (remove-hook 'write-file-functions + #'makefile-warn-suspicious-lines t) + (remove-hook 'write-file-functions + #'makefile-warn-continuations t)))) + +(use-package eglot + :preface + (defun +eglot-eldoc () + ;; https://www.masteringemacs.org/article/seamlessly-merge-multiple-documentation-sources-eldoc + (setq eldoc-documentation-strategy #'eldoc-documentation-compose-eagerly)) + :hook + ((bash-ts-mode . eglot)) + :config + (add-hook 'eglot-managed-mode . +eglot-eldoc)) + +(use-package eldoc + :config + (setopt 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))) + (eldoc-add-command-completions "paredit-")) + ;;; Applications @@ -298,8 +344,8 @@ With prefix ARG, toggle the value of (not (eobp))) (titlecase-region (progn (org-beginning-of-line) (point)) (progn (org-end-of-line) (point))))))) - :bind (:map scule-map - ("M-t" . titlecase-dwim))) + :config + (keymap-set scule-map "M-t" #'titlecase-dwim)) (use-package scule :load-path "~/src/emacs/scule/" @@ -367,11 +413,16 @@ With prefix ARG, toggle the value of ("." . 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 "%n " - ;; jabber-browse-buffer-format "%n " - ;; jabber-groupchat-buffer-format "%n " - ;; jabber-muc-private-buffer-format "%n " + 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) @@ -404,7 +455,8 @@ With prefix ARG, toggle the value of (defun jabber-chat@leave-when-kill () (add-hook 'kill-buffer-hook (defun @jabber-leave@kill () - (apply #'jabber-muc-leave (jabber-muc-argument-list))) + (ignore-errors + (apply #'jabber-muc-leave (jabber-muc-argument-list)))) nil :local))) (when (fboundp 'jabber-chat-update-focus) (add-hook 'window-configuration-change-hook #'jabber-chat-update-focus)) @@ -423,13 +475,17 @@ With prefix ARG, toggle the value of (buffer-list)))))) (add-to-list 'consult-buffer-sources 'jabber-chat-buffer-source :append) (consult-customize - consult-buffer :preview-key (kbd "M-.")))) + consult-buffer :preview-key "M-."))) (use-package keepassxc-shim :load-path "~/src/emacs/keepassxc-shim/" :config (keepassxc-shim-activate)) +(use-package hippie-completing-read + :load-path "~/src/emacs/hippie-completing-read/" + :bind (("M-/" . hippie-completing-read))) + ;;; External packages @@ -620,9 +676,7 @@ The prefix argument is as in `visual-fill-column-widen' but negated." prefix))))) ;; Add strings to this list to inhibit adding a space ;; after them. - '(",@")))))) - (with-eval-after-load 'eldoc - (eldoc-add-command #'paredit-backward-delete #'paredit-close-round))) + '(",@"))))))) (use-package hungry-delete :ensure t @@ -666,9 +720,16 @@ The prefix argument is as in `visual-fill-column-widen' but negated." :preface (setopt inferior-lisp-program (choose-executable "sbcl")) :when inferior-lisp-program - :bind (:map sly-mode-map - ("C-c C-z" . sly-mrepl)) + :init + (defun +sly-start-or-mrepl () + (interactive) + (if (ignore-errors (sly-connection)) + (sly-mrepl (lambda (buf) + (display-buffer-pop-up-window buf nil))) + (call-interactively #'sly))) :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) (sly-symbol-completion-mode -1)) @@ -728,6 +789,9 @@ The prefix argument is as in `visual-fill-column-widen' but negated." :ensure t :bind ("C-x g" . magit)) +(use-package git-modes + :ensure t) + (use-package eradio :ensure t :preface @@ -800,6 +864,13 @@ With PREFIX, prompt to change the current dictionary." :bind (:map dired-mode-map ("." . dired-hide-dotfiles-mode))) +(use-package dired-git-info + :ensure t + :bind (:map dired-mode-map + (")" . dired-git-info-mode)) + :config + (setopt dgi-auto-hide-details-p nil)) + (use-package embrace :ensure t :preface @@ -860,45 +931,64 @@ 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 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-guile ; Let's try using guile instead + :ensure t + :config + (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) - :vc (:url "https://github.com/renzmann/treesit-auto") - :config - (setopt treesit-extra-load-path - ;; https://github.com/casouri/tree-sitter-module/ - `(,(expand-file-name "~/misc/tree-sitter-module/dist/"))) - (treesit-auto-apply-remap) - (define-advice treesit-install-language-grammar (:after (&rest _) apply-remap) - (treesit-auto-apply-remap))) + :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 + :init (detached-init) + :bind (([remap async-shell-command] . detached-shell-command) + ([remap compile] . detached-compile) + ([remap recompile] . detached-compile-recompile)) + :config + (setf detached-terminal-data-command system-type) + (with-eval-after-load 'consult + (global-set-key [remap detached-open-session] #'detached-consult-session))) diff --git a/lisp/acdw-mail.el b/lisp/acdw-mail.el index ae78fa0..2a7d128 100644 --- a/lisp/acdw-mail.el +++ b/lisp/acdw-mail.el @@ -15,7 +15,7 @@ :key-type (symbol :tag "Variable") :value-type (sexp :tag "Value")))) -(defcustom +notmuch-spam-tags '("+spam") +(defcustom +notmuch-spam-tags '("+spam -inbox -unread") "List of tag changes to apply when marking a thread as spam." :group 'notmuch :type '(repeat string)) @@ -133,15 +133,17 @@ the saved search as well." (interactive) (if (require 'async nil t) (progn - (message "Polling mail async...") + (message "Polling mail (async)...") (async-start (lambda () - (push "~/usr/share/emacs/site-lisp/" load-path) - (require 'notmuch-lib) - (notmuch-poll)) - (lambda (result) - (message "%s" result)))) - (user-error "Feature `async' not found!"))) + (ignore-errors + (push "~/usr/share/emacs/site-lisp/" load-path) + (require 'notmuch-lib) + (notmuch-poll))) + (lambda (_) + (message "Polling mail (async)...done")))) + ;;(user-error "Feature `async' not found!") + (notmuch-poll))) ;;; Packages @@ -180,7 +182,7 @@ the saved search as well." notmuch-search-oldest-first nil notmuch-archive-tags '("-inbox" "-unread") notmuch-draft-tags '("+draft" "-inbox" "-unread") - +notmuch-spam-tags '("+spam" "+Spam") + +notmuch-spam-tags '("+spam") mail-user-agent 'notmuch-user-agent message-mail-user-agent t notmuch-show-indent-content nil @@ -253,5 +255,9 @@ This version doesn't add any initial-input." ;; Load init file (load notmuch-init-file :noerror)) +(use-package notmuch-tags + :load-path "~/src/emacs/notmuch-tags.el/" + :commands (notmuch-tags-mode)) + (provide 'acdw-mail) ;;; acdw-mail.el ends here diff --git a/lisp/acdw-org.el b/lisp/acdw-org.el index 5255a50..566deed 100644 --- a/lisp/acdw-org.el +++ b/lisp/acdw-org.el @@ -241,6 +241,7 @@ If LIST is non-nil, return the result as a list instead of a string." (org-property-value ((t :inherit fixed-pitch))) (org-special-keyword ((t :inherit fixed-pitch))) (org-indent ((t :inherit fixed-pitch))) + (org-table ((t :inherit fixed-pitch))) :config ;; Options (setopt org-adapt-indentation nil @@ -305,14 +306,15 @@ If LIST is non-nil, return the result as a list instead of a string." (keymap-set org-mode-map "RET" #'+org-return-dwim) (keymap-set org-mode-map "S-" #'+org-table-copy-down|+org-return-dwim) ;; Hooks - (add-hook 'org-mode-hook #'variable-pitch-mode) - (autoload 'visual-fill-column-mode "visual-fill-column" nil t) - (add-hook 'org-mode-hook #'visual-fill-column-mode) - (add-hook 'org-mode-hook #'turn-off-auto-fill) - (add-hook 'org-mode-hook #'org-indent-mode) - (add-hook 'org-mode-hook #'abbrev-mode) (add-hook 'org-mode-hook - (defun before-save@org-mode () + (defun org-mode@setup () + (when (require 'visual-fill-column nil t) + (setq-local visual-fill-column-extra-text-width '(8 . 8)) + (visual-fill-column-mode)) + (variable-pitch-mode) + (turn-off-auto-fill) + (org-indent-mode) + (abbrev-mode) (add-hook 'before-save-hook (defun before-save@org-mode@before-save () (org-align-tags 'all) @@ -331,6 +333,21 @@ If LIST is non-nil, return the result as a list instead of a string." "\\(?:[ ]+\\|$\\)\\)?") 0 'org-indent)))) +(use-package org-clock + :bind (("M-" . org-clock-out) + :map org-mode-map + ("" . org-clock-in) + ("" . org-clock-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))))) + (use-package org-agenda :bind (("C-c a" . org-agenda)) :config @@ -359,6 +376,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) (define-advice org-agenda-files (:filter-return (files) skip-regexp) "Filter some files from `org-agenda'." (when org-agenda-skip-file-regexp @@ -424,11 +442,19 @@ effect for exporting link types)." :height 1.0))) :config (setopt org-modern-star nil + org-modern-list '((43 . "◦") + (45 . "•") + (42 . "‣")) org-hide-leading-stars nil org-modern-hide-stars nil org-tags-column 0 - org-modern-keyword nil) + org-modern-keyword nil + org-modern-table nil) (global-org-modern-mode)) +(use-package org-taskwise + :after org + :load-path "~/src/emacs/org-taskwise/") + (provide 'acdw-org) ;;; acdw-org.el ends here -- cgit 1.4.1-21-gabe81