From 57f0dd43c4147d69b4a6ab4d482d353ae520ab63 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Wed, 27 Apr 2022 08:38:03 -0500 Subject: bleh --- init.el | 101 +++++++++++++++++++++++++++++++++++++++----------------- lisp/+jabber.el | 12 +++++++ 2 files changed, 83 insertions(+), 30 deletions(-) diff --git a/init.el b/init.el index ca0c507..dc3427b 100644 --- a/init.el +++ b/init.el @@ -55,6 +55,8 @@ line-number-minor-tick line-number-current-line)) (:face face '((t (:inherit fixed-pitch))))) + (:face 'font-lock-comment-face '((t ( :inherit variable-pitch + :slant italic)))) ;; Hooks (add-hook 'prog-mode-hook #'turn-on-auto-fill) (add-hook 'prog-mode-hook #'font-lock-todo-insinuate) @@ -732,9 +734,13 @@ org-agenda-file-regexp org-agenda-templates)) (add-to-list '+custom-variable-allowlist var)) + (define-advice org-agenda-files (:filter-return (ret)) + "Remove SyncThing's sync-conflict files from the org agenda." + (seq-remove (lambda (f) (string-match-p "sync-conflict" f)) ret)) (:+leader "a" #'org-agenda "C-a" #'org-agenda) (:hook #'hl-line-mode) - (add-hook 'org-agenda-after-show-hook 'org-narrow-to-subtree)) + (:local-set truncate-lines t) + (add-hook 'org-agenda-after-show-hook #'org-narrow-to-subtree)) (setup org-attach (:also-load +org-attach) @@ -825,12 +831,7 @@ (setup scratch (:require +scratch) (:option initial-major-mode #'lisp-interaction-mode - initial-scratch-message - (concat (replace-regexp-in-string "^" ";; " - (string-trim (if (executable-find "fortune") - (shell-command-to-string "fortune -s") - "ABANDON ALL HOPE YE WHO ENTER HERE"))) - "\n\n")) + initial-scratch-message (+scratch-fortune)) (add-hook 'kill-buffer-query-functions #'+scratch-immortal)) (setup shr @@ -927,8 +928,8 @@ They are completed by \"M-x TAB\" only in Tramp debug buffers." (setq affe-regexp-compiler (defun affe-orderless-regexp-compiler (input &rest _) (setq input (orderless-pattern-compiler input)) (cons input (lambda (str) (orderless--highlight input str))))) - (setf (alist-get 'affe-grep vertico-multiform-commands) '(buffer) - (alist-get 'affe-find vertico-multiform-commands) '(buffer)) + (setf (alist-get 'affe-grep vertico-multiform-commands) nil + (alist-get 'affe-find vertico-multiform-commands) nil) (:+key "M-s g" #'affe-grep "M-s f" #'affe-find))) @@ -1023,6 +1024,13 @@ They are completed by \"M-x TAB\" only in Tramp debug buffers." (with-eval-after-load 'notifications (add-hook 'bongo-player-metadata-changed-hook #'+bongo-notify))) +(setup (:straight browse-kill-ring) + (:+key "C-M-y" #'browse-kill-ring) + (:option browse-kill-ring-highlight-current-entry t + browse-kill-ring-highlight-inserted-item 'pulse + browse-kill-ring-separator " ") + (:hook #'form-feed-mode)) + (setup (:straight (cape :host github :repo "minad/cape")) (dolist (fn @@ -1330,7 +1338,7 @@ They are completed by \"M-x TAB\" only in Tramp debug buffers." consult-imenu consult-imenu-multi consult-outline)) - (setf (alist-get buf-cmd vertico-multiform-commands) '(buffer)))))) + (setf (alist-get buf-cmd vertico-multiform-commands) nil))))) (setup (:straight consult-dir) (:+key "C-x C-d" #'consult-dir) @@ -1341,8 +1349,8 @@ They are completed by \"M-x TAB\" only in Tramp debug buffers." (setup (:straight consult-notmuch) (:load-after consult notmuch) (with-eval-after-load 'vertico-multiform - (setf (alist-get 'consult-notmuch vertico-multiform-commands) '(buffer) - (alist-get 'consult-notmuch-tree vertico-multiform-commands) '(buffer)))) + (setf (alist-get 'consult-notmuch vertico-multiform-commands) nil + (alist-get 'consult-notmuch-tree vertico-multiform-commands) nil))) (setup (:straight corfu :quit "Turns out, I actually like minibuffer completion better.") @@ -1501,7 +1509,8 @@ See also `crux-reopen-as-root-mode'." (file+olp ,(car rmh-elfeed-org-files) "Feeds") "* %? %^g"))) -(setup (:straight elpher)) +(setup (:straight elpher) + (:bind "l" #'elpher-back)) (setup (:straight embark) (:require embark @@ -1633,6 +1642,8 @@ See also `crux-reopen-as-root-mode'." forge-gitea-repository))) (setup (:straight form-feed) + ;; See also `page-break-lines', further down. + (:face 'form-feed-line '((t (:strike-through t)))) (global-form-feed-mode +1)) (setup (:straight (frowny @@ -1684,7 +1695,12 @@ See also `crux-reopen-as-root-mode'." describe-function describe-variable helpful-function helpful-macro helpful-callable helpful-variable)) - (setf (alist-get cmd vertico-multiform-commands) nil)))) + (setf (alist-get cmd vertico-multiform-commands) nil))) + ;; Load faster on first invocation by pre-loading a slow function + ;; (see https://github.com/Wilfred/helpful/issues/236) + (run-with-idle-timer 1 nil (lambda () + (require 'info-look) + (info-lookup-setup-mode 'symbol 'emacs-lisp-mode)))) (setup (:straight (hippie-completing-read :host github @@ -1753,25 +1769,32 @@ See also `crux-reopen-as-root-mode'." "jabber-fallback-lib/hexrgb.el" "jabber-fallback-lib/srv.el" "jabber-fallback-lib/fsm.el") - "jabber-pkg.el"))) + "jabber-pkg.el") + :fork ( :host nil + :repo "https://codeberg.org/acdw/emacs-jabber"))) (:also-load +jabber) - (defvar +jabber-ws-prefix 8 "Width to pad left side of chats.") + (defvar +jabber-ws-prefix 0 "Width to pad left side of chats.") + (defvar +jabber-pre-prompt " \n" + "String to show before a prompt.") (:option jabber-account-list '(("acdw@hmm.st")) - jabber-groupchat-buffer-format "X:%n" - jabber-chat-buffer-format "X:%n" - jabber-muc-private-buffer-format "X:%n(%g)" + jabber-groupchat-buffer-format "%n" + jabber-chat-buffer-format "%n" + jabber-muc-private-buffer-format "%n(%g)" jabber-activity-show-p #'ignore jabber-muc-decorate-presence-patterns '(("\\( enters the room ([^)]+)\\| has left the chatroom\\)$") ("." . jabber-muc-presence-dim)) jabber-muc-colorize-foreign t - jabber-chat-foreign-prompt-format (concat "[%t] %n:\n" + jabber-chat-foreign-prompt-format (concat +jabber-pre-prompt + "[%t] %n\n" (make-string +jabber-ws-prefix ?\ )) - jabber-chat-local-prompt-format (concat "[%t] %n:\n" + jabber-chat-local-prompt-format (concat +jabber-pre-prompt + "[%t] %n\n" (make-string +jabber-ws-prefix ?\ )) - jabber-groupchat-prompt-format (concat "[%t] %n:\n" + jabber-groupchat-prompt-format (concat +jabber-pre-prompt + "[%t] %n\n" (make-string +jabber-ws-prefix ?\ )) jabber-auto-reconnect t) @@ -1780,20 +1803,28 @@ See also `crux-reopen-as-root-mode'." (modus-themes-with-colors (:face 'jabber-chat-prompt-foreign `((t (:foreground ,red))) 'jabber-chat-prompt-local `((t (:foreground ,blue))) - 'jabber-chat-prompt-system `((t (:foreground ,green))))))) + 'jabber-chat-prompt-system `((t (:foreground ,green))))) + (setq jabber-muc-nick-value (pcase (frame--current-backround-mode (selected-frame)) + ('light 0.5) + ('dark 1.0))) + (+mapc-some-buffers #'+jabber-colors-update + (lambda () (derived-mode-p 'jabber-chat-mode + 'jabber-roster-mode + 'jabber-activity-mode + 'jabber-browse-mode))))) (dolist (mode '(jabber-chat-mode jabber-browse-mode jabber-roster-mode jabber-console-mode)) - (add-hook (intern (format "%s-hook" mode)) #'visual-fill-column-mode)) + (let ((hook (intern (format "%s-hook" mode)))) + (add-hook hook #'visual-fill-column-mode))) (add-hook 'jabber-activity-mode-hook #'tracking-mode) (:with-mode jabber-chat-mode (:local-set +modeline-position-function (lambda () (cond ((string-match-p "hmm@" (buffer-name)) "🤔 "))) - wrap-prefix (make-string +jabber-ws-prefix ?\ ) - )) + wrap-prefix (make-string +jabber-ws-prefix ?\ ))) (:+leader "C-j" jabber-global-keymap) (advice-add 'jabber-activity-add :after #'+jabber-tracking-add) (advice-add 'jabber-activity-add-muc :after #'+jabber-tracking-add-muc)) @@ -1933,9 +1964,8 @@ See also `crux-reopen-as-root-mode'." (:face 'modus-themes-tab-active '((t :bold nil)) 'modus-themes-tab-inactive '((t :italic t))) - ;; Fix a "nil is not a Modus theme" error - ;; XXX: Need to register a bug report (define-advice modus-themes--current-theme (:around (fn &rest r)) + "Fix a \"nil is not a Modus theme\" error." (or (apply fn r) 'modus-operandi)) @@ -1996,6 +2026,10 @@ See also `crux-reopen-as-root-mode'." :quit "Buggy") (:load-after notmuch)) +(setup (:straight nov) + (:hook #'visual-fill-column-mode) + (:file-match (rx ".epub" eos))) + (setup (:straight ol-notmuch)) (setup (:straight orderless) @@ -2045,7 +2079,8 @@ See also `crux-reopen-as-root-mode'." (setup (:straight org-modern) (:option org-modern-hide-stars nil org-modern-star nil - org-modern-list nil) + org-modern-list nil + org-modern-progress ["..." "o.." "oo." "Oo." "Ooo" "OOo" "OOO"]) (:face 'org-modern-label '((t ( :height 1.0 :weight regular :underline nil @@ -2079,6 +2114,10 @@ See also `crux-reopen-as-root-mode'." ;; Remove it from init.el files (add-hook '+init-mode-hook #'flymake-mode-off)) +(setup (:straight page-break-lines) + (:option page-break-lines-char ?—) + (:hook-into jabber-chat-mode)) + (setup (:straight paredit) (:also-load +paredit) (:bind "DEL" #'paredit-backward-delete @@ -2349,7 +2388,7 @@ See also `crux-reopen-as-root-mode'." (setf (alist-get 'completion-at-point vertico-multiform-commands) '(flat)) (setf (alist-get 'indent-for-tab-command vertico-multiform-commands) '(flat)) (setf (alist-get 'insert-char vertico-multiform-commands) nil) - (setf (alist-get 'file vertico-multiform-categories) '(buffer)) + (setf (alist-get 'file vertico-multiform-categories) nil) (setf (alist-get 'bookmark vertico-multiform-categories) nil) ;; Default. Needs to be `add-to-list' so that it appears at the end. (add-to-list 'vertico-multiform-categories '(t flat) :append) @@ -2421,6 +2460,8 @@ See also `crux-reopen-as-root-mode'." (:also-load +xkcd) (:hook #'visual-fill-column-mode)) +(setup (:straight xr)) + (setup (:straight yaoddmuse)) (setup (:straight yasnippet) diff --git a/lisp/+jabber.el b/lisp/+jabber.el index 2382102..c5d568c 100644 --- a/lisp/+jabber.el +++ b/lisp/+jabber.el @@ -250,5 +250,17 @@ associated face. Ignore notification if face is ‘nil’." (buffer-string)) :time (current-time)))))))))))) +(defun +jabber-colors-update (&optional buffer) + "Update jabber colors in BUFFER, defaulting to the current." + (with-current-buffer (or buffer (current-buffer)) + (when jabber-buffer-connection + (setq jabber-muc-participant-colors nil) + (cond (jabber-chatting-with + (jabber-chat-create-buffer jabber-buffer-connection + jabber-chatting-with)) + (jabber-group + (jabber-muc-create-buffer jabber-buffer-connection + jabber-group)))))) + (provide '+jabber) ;;; +jabber.el ends here -- cgit 1.4.1-21-gabe81