diff options
| author | cashmere <cashmere1337@riseup.net> | 2026-09-28 09:18:56 +0200 |
|---|---|---|
| committer | cashmere <cashmere1337@riseup.net> | 2026-09-28 09:18:56 +0200 |
| commit | 14477177ad8456e2c5f30eba295a36778f1b71e5 (patch) | |
| tree | eede0a57392fc71bb7a0430d15edf965c4c9098a | |
| parent | 4b4af818d1e95449b635cc15b92f946c3d023edd (diff) | |
| download | emacs-master.tar.gz | |
| -rw-r--r-- | config.el | 132 | ||||
| -rw-r--r-- | config.org | 138 |
2 files changed, 30 insertions, 240 deletions
@@ -730,7 +730,9 @@ Temporarily disables notifications during the fetch." (name . "^\\*info\\*$") (name . "^\\*scratch\\*$") (name . "^\\*Backtrace\\*$") - (name . "^\\*Messages\\*$")))))) + (name . "^\\*Messages\\*$"))) + ("Helm") ( + (mode . helm-mode))))) :hook (ibuffer-mode . (lambda () (ibuffer-switch-to-saved-filter-groups "Main")))) @@ -798,110 +800,6 @@ Temporarily disables notifications during the fetch." (add-hook 'enable-theme-functions #'my/markdown-apply-minimal-faces) (my/markdown-apply-minimal-faces)) -(defun my/agent-shell-autoscroll (&rest _) - (dolist (win (get-buffer-window-list (current-buffer) 'visible)) - (when (>= (window-point win) - (save-excursion (goto-char (point-max)) (point))) - (set-window-point win (point-max))))) - -(defun my/agent-shell-ret-binding () - (let ((keymap (get-text-property (point) 'keymap))) - (when keymap - (let ((binding (lookup-key keymap (kbd "RET")))) - (when (commandp binding) - binding))))) - -(defun my/agent-shell-output-at-point-p () - (or (get-text-property (point) 'agent-shell-ui-state) - (and (> (point) (point-min)) - (get-text-property (1- (point)) 'agent-shell-ui-state)))) - -(defun my/agent-shell-ret () - (interactive) - (if-let* ((binding (my/agent-shell-ret-binding))) - (call-interactively binding) - (cond - ((my/agent-shell-output-at-point-p) - (agent-shell-ui-toggle-fragment)) - ((and (derived-mode-p 'agent-shell-mode) - (shell-maker-point-at-last-prompt-p)) - (agent-shell-submit)) - ((derived-mode-p 'agent-shell-viewport-view-mode) - (agent-shell-viewport-next-item)) - ((derived-mode-p 'agent-shell-mode) - (agent-shell-next-item))))) - - -(defun my/agent-shell-display-buffer-rules () - '(("\\*Kimi\\(?:\\*\\|:[^*]*\\*\\)" - (display-buffer-in-side-window) - (side . bottom) - (slot . 0) - (window-height . 0.33) - (dedicated . t) - (window-parameters . ((no-other-window . nil) - (no-delete-other-windows . nil)))) - ("\\*agent-shell-diff\\*" - (display-buffer-in-side-window) - (side . right) - (slot . 1) - (window-width . 0.5) - (dedicated . t) - (window-parameters . ((no-other-window . nil) - (no-delete-other-windows . nil)))))) - -(use-package agent-shell - :ensure t - :config - (advice-add 'shell-maker-submit :after #'my/agent-shell-autoscroll) - (dolist (rule (my/agent-shell-display-buffer-rules)) - (add-to-list 'display-buffer-alist rule)) - (setq agent-shell-tool-use-expand-by-default nil) - (setq agent-shell-thought-process-expand-by-default t) - (setq agent-shell-user-message-expand-by-default t) - (setq agent-shell-activity-group-expand-by-default t) - (setq agent-shell-diff-delta-command - (when (executable-find "delta") - '("delta" "--no-gitconfig" "--color-only"))) - (setq agent-shell-activity-group-header-label-function - #'agent-shell-activity-group-descriptive-label) - ;; Work around agent-shell's `window-system' guard so clipboard images - ;; work in terminal Emacs (`emacs -nw'). The underlying save routine - ;; already shells out to wl-paste/xclip/pngpaste/powershell, none of - ;; which require a GUI frame. - (defun my/agent-shell-send-clipboard-image-in-terminal (orig-fn &optional pick-shell) - "Call ORIG-FN, but allow `agent-shell-send-clipboard-image' in terminal Emacs." - (if (window-system) - (funcall orig-fn pick-shell) - (let* ((screenshots-dir (agent-shell--dot-subdir "screenshots")) - (image-path (agent-shell--save-clipboard-image - :destination-dir screenshots-dir)) - (shell-buffer (when pick-shell - (agent-shell--read-shell-buffer - :prompt "Send image to shell: ")))) - (agent-shell-insert - :text (agent-shell--get-files-context :files (list image-path)) - :shell-buffer shell-buffer)))) - (advice-add 'agent-shell-send-clipboard-image :around - #'my/agent-shell-send-clipboard-image-in-terminal) - - ;; Also let C-y / `agent-shell-yank-dwim' try the clipboard image first - ;; in terminal Emacs before falling back to plain text yank. - (defun my/agent-shell-yank-dwim-in-terminal (orig-fn &optional arg) - "Call ORIG-FN, but try clipboard image first in terminal Emacs." - (if (window-system) - (funcall orig-fn arg) - (if-let* ((screenshots-dir (agent-shell--dot-subdir "screenshots")) - (image-path (agent-shell--save-clipboard-image - :destination-dir screenshots-dir - :no-error t))) - (agent-shell-insert - :text (agent-shell--get-files-context :files (list image-path)) - :shell-buffer (agent-shell--shell-buffer)) - (funcall orig-fn arg)))) - (advice-add 'agent-shell-yank-dwim :around - #'my/agent-shell-yank-dwim-in-terminal)) - (use-package eldoc :ensure nil :config @@ -4660,18 +4558,18 @@ opened directly with `mu4e-compose-new'." (mu4e-trash-folder . "/riseup/Trash") (mu4e-refile-folder . "/riseup/Archive"))) - ,(make-mu4e-context - :name "autistici" - :match-func - (lambda (msg) - (when msg - (string-prefix-p "/autistici" (mu4e-message-field msg :maildir)))) - :vars '((user-mail-address . "cashmeresamurai@autistici.org") - (user-full-name . "cashmere") - (mu4e-drafts-folder . "/autistici/Drafts") - (mu4e-sent-folder . "/autistici/Sent") - (mu4e-trash-folder . "/autistici/Trash") - (mu4e-refile-folder . "/autistici/Archive"))) + ;; (make-mu4e-context + ;; :name "autistici" + ;; :match-func + ;; (lambda (msg) + ;; (when msg + ;; (string-prefix-p "/autistici" (mu4e-message-field msg :maildir)))) + ;; :vars '((user-mail-address . "cashmeresamurai@autistici.org") + ;; (user-full-name . "cashmere") + ;; (mu4e-drafts-folder . "/autistici/Drafts") + ;; (mu4e-sent-folder . "/autistici/Sent") + ;; (mu4e-trash-folder . "/autistici/Trash") + ;; (mu4e-refile-folder . "/autistici/Archive"))) ,(make-mu4e-context :name "cashmere" @@ -830,7 +830,9 @@ I adjusted the config accordingly to my modes which I use on a frequent. (name . "^\\*info\\*$") (name . "^\\*scratch\\*$") (name . "^\\*Backtrace\\*$") - (name . "^\\*Messages\\*$")))))) + (name . "^\\*Messages\\*$"))) + ("Helm") ( + (mode . helm-mode))))) :hook (ibuffer-mode . (lambda () (ibuffer-switch-to-saved-filter-groups "Main")))) @@ -916,116 +918,6 @@ Not necessary but an eyecandy to look at! (my/markdown-apply-minimal-faces)) #+end_src -** agent-shell - -let's give agent-shell another try - -#+begin_src emacs-lisp -(defun my/agent-shell-autoscroll (&rest _) - (dolist (win (get-buffer-window-list (current-buffer) 'visible)) - (when (>= (window-point win) - (save-excursion (goto-char (point-max)) (point))) - (set-window-point win (point-max))))) - -(defun my/agent-shell-ret-binding () - (let ((keymap (get-text-property (point) 'keymap))) - (when keymap - (let ((binding (lookup-key keymap (kbd "RET")))) - (when (commandp binding) - binding))))) - -(defun my/agent-shell-output-at-point-p () - (or (get-text-property (point) 'agent-shell-ui-state) - (and (> (point) (point-min)) - (get-text-property (1- (point)) 'agent-shell-ui-state)))) - -(defun my/agent-shell-ret () - (interactive) - (if-let* ((binding (my/agent-shell-ret-binding))) - (call-interactively binding) - (cond - ((my/agent-shell-output-at-point-p) - (agent-shell-ui-toggle-fragment)) - ((and (derived-mode-p 'agent-shell-mode) - (shell-maker-point-at-last-prompt-p)) - (agent-shell-submit)) - ((derived-mode-p 'agent-shell-viewport-view-mode) - (agent-shell-viewport-next-item)) - ((derived-mode-p 'agent-shell-mode) - (agent-shell-next-item))))) - - -(defun my/agent-shell-display-buffer-rules () - '(("\\*Kimi\\(?:\\*\\|:[^*]*\\*\\)" - (display-buffer-in-side-window) - (side . bottom) - (slot . 0) - (window-height . 0.33) - (dedicated . t) - (window-parameters . ((no-other-window . nil) - (no-delete-other-windows . nil)))) - ("\\*agent-shell-diff\\*" - (display-buffer-in-side-window) - (side . right) - (slot . 1) - (window-width . 0.5) - (dedicated . t) - (window-parameters . ((no-other-window . nil) - (no-delete-other-windows . nil)))))) - -(use-package agent-shell - :ensure t - :config - (advice-add 'shell-maker-submit :after #'my/agent-shell-autoscroll) - (dolist (rule (my/agent-shell-display-buffer-rules)) - (add-to-list 'display-buffer-alist rule)) - (setq agent-shell-tool-use-expand-by-default nil) - (setq agent-shell-thought-process-expand-by-default t) - (setq agent-shell-user-message-expand-by-default t) - (setq agent-shell-activity-group-expand-by-default t) - (setq agent-shell-diff-delta-command - (when (executable-find "delta") - '("delta" "--no-gitconfig" "--color-only"))) - (setq agent-shell-activity-group-header-label-function - #'agent-shell-activity-group-descriptive-label) - ;; Work around agent-shell's `window-system' guard so clipboard images - ;; work in terminal Emacs (`emacs -nw'). The underlying save routine - ;; already shells out to wl-paste/xclip/pngpaste/powershell, none of - ;; which require a GUI frame. - (defun my/agent-shell-send-clipboard-image-in-terminal (orig-fn &optional pick-shell) - "Call ORIG-FN, but allow `agent-shell-send-clipboard-image' in terminal Emacs." - (if (window-system) - (funcall orig-fn pick-shell) - (let* ((screenshots-dir (agent-shell--dot-subdir "screenshots")) - (image-path (agent-shell--save-clipboard-image - :destination-dir screenshots-dir)) - (shell-buffer (when pick-shell - (agent-shell--read-shell-buffer - :prompt "Send image to shell: ")))) - (agent-shell-insert - :text (agent-shell--get-files-context :files (list image-path)) - :shell-buffer shell-buffer)))) - (advice-add 'agent-shell-send-clipboard-image :around - #'my/agent-shell-send-clipboard-image-in-terminal) - - ;; Also let C-y / `agent-shell-yank-dwim' try the clipboard image first - ;; in terminal Emacs before falling back to plain text yank. - (defun my/agent-shell-yank-dwim-in-terminal (orig-fn &optional arg) - "Call ORIG-FN, but try clipboard image first in terminal Emacs." - (if (window-system) - (funcall orig-fn arg) - (if-let* ((screenshots-dir (agent-shell--dot-subdir "screenshots")) - (image-path (agent-shell--save-clipboard-image - :destination-dir screenshots-dir - :no-error t))) - (agent-shell-insert - :text (agent-shell--get-files-context :files (list image-path)) - :shell-buffer (agent-shell--shell-buffer)) - (funcall orig-fn arg)))) - (advice-add 'agent-shell-yank-dwim :around - #'my/agent-shell-yank-dwim-in-terminal)) -#+end_src - * eldoc #+begin_src emacs-lisp @@ -5577,18 +5469,18 @@ opened directly with `mu4e-compose-new'." (mu4e-trash-folder . "/riseup/Trash") (mu4e-refile-folder . "/riseup/Archive"))) - ,(make-mu4e-context - :name "autistici" - :match-func - (lambda (msg) - (when msg - (string-prefix-p "/autistici" (mu4e-message-field msg :maildir)))) - :vars '((user-mail-address . "cashmeresamurai@autistici.org") - (user-full-name . "cashmere") - (mu4e-drafts-folder . "/autistici/Drafts") - (mu4e-sent-folder . "/autistici/Sent") - (mu4e-trash-folder . "/autistici/Trash") - (mu4e-refile-folder . "/autistici/Archive"))) + ;; (make-mu4e-context + ;; :name "autistici" + ;; :match-func + ;; (lambda (msg) + ;; (when msg + ;; (string-prefix-p "/autistici" (mu4e-message-field msg :maildir)))) + ;; :vars '((user-mail-address . "cashmeresamurai@autistici.org") + ;; (user-full-name . "cashmere") + ;; (mu4e-drafts-folder . "/autistici/Drafts") + ;; (mu4e-sent-folder . "/autistici/Sent") + ;; (mu4e-trash-folder . "/autistici/Trash") + ;; (mu4e-refile-folder . "/autistici/Archive"))) ,(make-mu4e-context :name "cashmere" |
