Compare commits

..
13 Commits
9 changed files with 139 additions and 95 deletions

No files matched your search

+2 -1
View File
@@ -1,4 +1,5 @@
;; Disable package.el in favor of straight.el ;; -*- lexical-binding: t; -*-
;; Disable package.el in favor of elpaca
(setq package-enable-at-startup nil) (setq package-enable-at-startup nil)
(setq gc-cons-threshold most-positive-fixnum) (setq gc-cons-threshold most-positive-fixnum)
+96 -57
View File
@@ -1,3 +1,4 @@
;; -*- lexical-binding: t; -*-
;;; Preamble ;;; Preamble
;; Suppress native compilation warnings ;; Suppress native compilation warnings
(setq native-comp-async-report-warnings-errors nil) (setq native-comp-async-report-warnings-errors nil)
@@ -297,6 +298,9 @@ EMACS-ALTERNATIVE is the Emacs equivalent (e.g., 'C-s')."
:init :init
(vertico-mode) (vertico-mode)
(vertico-multiform-mode 1) (vertico-multiform-mode 1)
;; Preserve project.el's most-recently-used order in the project chooser.
(add-to-list 'vertico-multiform-commands
'(project-switch-project (vertico-sort-function . nil)))
(add-to-list 'vertico-multiform-categories (add-to-list 'vertico-multiform-categories
'(jinx grid (vertico-grid-annotate . 20)))) '(jinx grid (vertico-grid-annotate . 20))))
@@ -332,11 +336,12 @@ EMACS-ALTERNATIVE is the Emacs equivalent (e.g., 'C-s')."
;; Replace bindings. Lazily loaded due by `use-package'. ;; Replace bindings. Lazily loaded due by `use-package'.
:bind (("C-x b" . consult-buffer) :bind (("C-x b" . consult-buffer)
("C-x C-b" . consult-buffer) ("C-x C-b" . consult-buffer)
("C-x p g" . consult-ripgrep)
("C-x p b" . consult-project-buffer)
("C-x p F" . consult-fd)
("M-i" . consult-imenu) ("M-i" . consult-imenu)
("M-y" . consult-yank-from-kill-ring)) ("M-y" . consult-yank-from-kill-ring)
:map project-prefix-map
("g" . consult-ripgrep)
("b" . consult-project-buffer)
("F" . consult-fd))
;; Enable automatic preview at point in the *Completions* buffer. This is ;; Enable automatic preview at point in the *Completions* buffer. This is
;; relevant when you use the default completion UI. ;; relevant when you use the default completion UI.
@@ -472,9 +477,9 @@ EMACS-ALTERNATIVE is the Emacs equivalent (e.g., 'C-s')."
:ensure t) :ensure t)
;;;; Window size ;;;; Window size
(modify-all-frames-parameters '((alpha 99 99) (modify-all-frames-parameters '((alpha 99 99)
(top . 50) (top . 20)
(left . 100) (left . 20)
(width . 190) (width . 185)
(height . 60))) (height . 60)))
;;;; Fonts ;;;; Fonts
@@ -549,14 +554,20 @@ EMACS-ALTERNATIVE is the Emacs equivalent (e.g., 'C-s')."
"\\*Flycheck errors\\*" "\\*Flycheck errors\\*"
help-mode help-mode
compilation-mode compilation-mode
"\\`\\*gd-tmux\\*\\'"
"eshell-popup\\*$")) "eshell-popup\\*$"))
(defun my/popper-window-height (window) (defun my/popper-window-height (window)
"Make eshell popups take half the frame height, otherwise defer to popper--fit-window-height" "Resize terminal popups to half the frame height; fit other popups."
(let ((buffer (window-buffer window))) (let ((buffer (window-buffer window)))
(if (with-current-buffer buffer (if (with-current-buffer buffer
(derived-mode-p 'eshell-mode)) ;; Eshell displays a new buffer before enabling `eshell-mode'.
(/ (frame-height (window-frame window)) 2) (or (derived-mode-p 'eshell-mode)
(equal (buffer-name) "*gd-tmux*")
(string-match-p "eshell-popup\\*$" (buffer-name))))
;; A functional `window-height' action must resize the window.
(let ((height (/ (frame-height (window-frame window)) 2)))
(fit-window-to-buffer window height height))
(popper--fit-window-height window)))) (popper--fit-window-height window))))
(setq popper-window-height #'my/popper-window-height) (setq popper-window-height #'my/popper-window-height)
@@ -649,9 +660,37 @@ EMACS-ALTERNATIVE is the Emacs equivalent (e.g., 'C-s')."
;;;; Project ;;;; Project
(use-package project (use-package project
:custom
(project-prompter #'my/project-prompt)
(project-switch-commands
'((project-find-file "Find file")
(consult-ripgrep "Ripgrep")
(magit-status "Magit" ?m)
(project-eshell "Eshell")
(project-any-command "Other")))
:config :config
;; Make project.el recognize directories with a .project file as project roots ;; Make project.el recognize directories with a .project file as project roots
(add-to-list 'project-vc-extra-root-markers ".project")) (add-to-list 'project-vc-extra-root-markers ".project")
(defcustom my/project-search-path '("~/Projects/")
"Directories whose immediate children are scanned for projects."
:type '(repeat directory)
:group 'project)
(defun my/project-refresh ()
"Remember recognized projects directly under `my/project-search-path'."
(interactive)
(dolist (directory my/project-search-path)
(let ((directory (expand-file-name directory)))
(when (file-directory-p directory)
(project-remember-projects-under directory)))))
(defun my/project-prompt (&optional prompt predicate require-known)
"Refresh known projects, then prompt using the standard project chooser.
Pass PROMPT, PREDICATE and REQUIRE-KNOWN through to the chooser."
(let ((inhibit-message t))
(my/project-refresh))
(project-prompt-project-dir prompt predicate require-known)))
;;;; hl-todo ;;;; hl-todo
(use-package hl-todo (use-package hl-todo
@@ -691,21 +730,6 @@ EMACS-ALTERNATIVE is the Emacs equivalent (e.g., 'C-s')."
(first-executable '("xdg-open" "open")) (first-executable '("xdg-open" "open"))
nil nil nil ".")) nil nil nil "."))
;;;; Hyperbole
(use-package hyperbole
:if nil
:ensure (:repo "https://git.savannah.gnu.org/git/hyperbole.git" :tag "hyperbole-9.0.1")
:bind (("C-o h" . hyperbole)
("C-o w" . hycontrol-windows)
("C-o f" . hycontrol-frames)
:map hyperbole-mode-map
("M-<return>" . nil)
("C-o <return>" . hkey-either))
:custom
(hkey-init nil)
:init
(hyperbole-mode 1))
;;;; Emacs Server ;;;; Emacs Server
(server-start) (server-start)
;;;; Just ;;;; Just
@@ -858,6 +882,16 @@ EMACS-ALTERNATIVE is the Emacs equivalent (e.g., 'C-s')."
("C-j" . nil))) ("C-j" . nil)))
;;; Programming ;;; Programming
;;;; Agent-shell (Codex)
(use-package agent-shell
:ensure t
:bind (("C-c a" . agent-shell))
:custom
(agent-shell-preferred-agent-config 'codex)
:config
(setq agent-shell-openai-authentication
(agent-shell-openai-make-authentication :login t)))
;;;; Treesitter ;;;; Treesitter
(use-package treesit-auto (use-package treesit-auto
:ensure t :ensure t
@@ -915,6 +949,8 @@ EMACS-ALTERNATIVE is the Emacs equivalent (e.g., 'C-s')."
:commands lsp :commands lsp
:custom :custom
(lsp-completion-provider :none) (lsp-completion-provider :none)
(lsp-enable-suggest-server-download nil)
(lsp-warn-no-matched-clients nil)
:init :init
(setq lsp-keymap-prefix "C-c l") (setq lsp-keymap-prefix "C-c l")
;; from https://github.com/minad/corfu/wiki ;; from https://github.com/minad/corfu/wiki
@@ -922,36 +958,6 @@ EMACS-ALTERNATIVE is the Emacs equivalent (e.g., 'C-s')."
(setf (alist-get 'styles (alist-get 'lsp-capf completion-category-defaults)) (setf (alist-get 'styles (alist-get 'lsp-capf completion-category-defaults))
'(orderless))) '(orderless)))
(defun lsp-booster--advice-json-parse (old-fn &rest args)
"Try to parse bytecode instead of json."
(or
(when (equal (following-char) ?#)
(let ((bytecode (read (current-buffer))))
(when (byte-code-function-p bytecode)
(funcall bytecode))))
(apply old-fn args)))
(advice-add (if (progn (require 'json)
(fboundp 'json-parse-buffer))
'json-parse-buffer
'json-read)
:around
#'lsp-booster--advice-json-parse)
(defun lsp-booster--advice-final-command (old-fn cmd &optional test?)
"Prepend emacs-lsp-booster command to lsp CMD."
(let ((orig-result (funcall old-fn cmd test?)))
(if (and (not test?) ;; for check lsp-server-present?
(not (file-remote-p default-directory)) ;; see lsp-resolve-final-command, it would add extra shell wrapper
lsp-use-plists
(not (functionp 'json-rpc-connection)) ;; native json-rpc
(executable-find "emacs-lsp-booster"))
(progn
(when-let ((command-from-exec-path (executable-find (car orig-result)))) ;; resolve command from exec-path (in case not found in $PATH)
(setcar orig-result command-from-exec-path))
(message "Using emacs-lsp-booster for %s!" orig-result)
(cons "emacs-lsp-booster" orig-result))
orig-result)))
(advice-add 'lsp-resolve-final-command :around #'lsp-booster--advice-final-command)
:hook ((rust-ts-mode . lsp-deferred) :hook ((rust-ts-mode . lsp-deferred)
(python-ts-mode . lsp-deferred) (python-ts-mode . lsp-deferred)
(lsp-mode . lsp-enable-which-key-integration) (lsp-mode . lsp-enable-which-key-integration)
@@ -1041,7 +1047,7 @@ the new eshell window is selected."
(beginning-of-line) (beginning-of-line)
(= (point) orig)))) (= (point) orig))))
(progn (progn
(kill-this-buffer) (kill-current-buffer)
(when (not (one-window-p)) (when (not (one-window-p))
(delete-window))) (delete-window)))
(delete-char 1))) (delete-char 1)))
@@ -1159,15 +1165,48 @@ any directory proffered by `consult-dir'."
;;;; Eat ;;;; Eat
(use-package eat (use-package eat
:ensure t :ensure t
:bind (("C-o g" . my/gd-tmux-toggle))
:custom :custom
(eat-term-name "xterm-256color") (eat-term-name "xterm-256color")
:init :init
(defun my/gd-tmux-toggle ()
"Show or hide the tmux terminal on gd.
Connect the Tubnix tunnel in WireGuard first. Hiding the popup keeps
SSH alive; opening it after SSH exits reconnects to the existing tmux
session. With multiple sessions, tmux chooses its default session."
(interactive)
(if-let* ((window (get-buffer-window "*gd-tmux*")))
(quit-window nil window)
(require 'eat)
;; Always launch local SSH, even when called from a TRAMP buffer.
(let* ((default-directory (expand-file-name "~/"))
(buffer (eat-make "gd-tmux" "ssh" nil
"-t" "-o" "ConnectTimeout=10"
"-o" "ServerAliveInterval=15"
"-o" "ServerAliveCountMax=3"
"gd" "tmux attach-session")))
(with-current-buffer buffer
(use-local-map (copy-keymap (current-local-map)))
(local-set-key (kbd "q") #'quit-window)
;; Eat's input modes take precedence over the major-mode map.
(dolist (mode '(eat--semi-char-mode eat--char-mode))
(let ((map (make-sparse-keymap)))
(set-keymap-parent map (alist-get mode minor-mode-map-alist))
(define-key map (kbd "q") #'quit-window)
(setq-local minor-mode-overriding-map-alist
(cons (cons mode map)
(assq-delete-all
mode minor-mode-overriding-map-alist))))))
(pop-to-buffer buffer))))
(eval-after-load 'eshell #'eat-eshell-mode) (eval-after-load 'eshell #'eat-eshell-mode)
(eval-after-load 'eshell #'eat-eshell-visual-command-mode) (eval-after-load 'eshell #'eat-eshell-visual-command-mode)
:config :config
(defun advise-eat-keymap (map) (defun advise-eat-keymap (map)
(define-key map [?\C-o] nil) (define-key map [?\C-o] nil)
(define-key map (vector meta-prefix-char ?`) nil) (define-key map (vector meta-prefix-char ?`) nil)
;; Let Popper dismiss terminal windows without sending M-o remotely.
(define-key map (vector meta-prefix-char ?o) nil)
(define-key map [S-v] #'eat-yank)) (define-key map [S-v] #'eat-yank))
(define-advice eat-eshell-semi-char-mode (define-advice eat-eshell-semi-char-mode
+6 -27
View File
@@ -1,25 +1,5 @@
{ {
"nodes": { "nodes": {
"emacs-lsp-booster": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1744007427,
"narHash": "sha256-eccCwW7GQVSk/WOCxt5izY5VdVknheI3oAXa0Xg9k9U=",
"owner": "slotThe",
"repo": "emacs-lsp-booster-flake",
"rev": "8229947cf6d2f565a9aa882b7946c643099e1ef0",
"type": "github"
},
"original": {
"owner": "slotThe",
"repo": "emacs-lsp-booster-flake",
"type": "github"
}
},
"home-manager": { "home-manager": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@@ -27,11 +7,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1773093840, "lastModified": 1788985386,
"narHash": "sha256-u/96NoAyN8BSRuM3ZimGf7vyYgXa3pLx4MYWjokuoH4=", "narHash": "sha256-dTXvCtgUYxh7VXpaBDkgBK2XyHRA0PUhJDRLGEvXWLA=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "bb014746edb2a98d975abde4dd40fa240de4cf86", "rev": "9bdbf423512a9b45d9dac3c25e745f00cf2a6137",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -42,11 +22,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1772956932, "lastModified": 1788922888,
"narHash": "sha256-M0yS4AafhKxPPmOHGqIV0iKxgNO8bHDWdl1kOwGBwRY=", "narHash": "sha256-QMX3uerxnW2R5dHcWpIQILHDltOZnon3x3Spq7EzBFI=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "608d0cadfed240589a7eea422407a547ad626a14", "rev": "a391f95d4557d685fd8e5dc0d4b1f9271aa2f342",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -58,7 +38,6 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"emacs-lsp-booster": "emacs-lsp-booster",
"home-manager": "home-manager", "home-manager": "home-manager",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"utils": "utils" "utils": "utils"
+2 -6
View File
@@ -2,11 +2,9 @@
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
utils.url = "github:numtide/flake-utils"; utils.url = "github:numtide/flake-utils";
emacs-lsp-booster.url = "github:slotThe/emacs-lsp-booster-flake";
home-manager.url = "github:nix-community/home-manager"; home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs"; home-manager.inputs.nixpkgs.follows = "nixpkgs";
emacs-lsp-booster.inputs.nixpkgs.follows = "nixpkgs";
}; };
outputs = { outputs = {
@@ -14,14 +12,11 @@
nixpkgs, nixpkgs,
utils, utils,
home-manager, home-manager,
emacs-lsp-booster,
...}: let ...}: let
pkgsForSystem = (system: import nixpkgs { pkgsForSystem = (system: import nixpkgs {
inherit system; inherit system;
overlays = [
emacs-lsp-booster.overlays.default
];
config.allowUnfree = true; config.allowUnfree = true;
overlays = [ (import ./overlays/codex-acp.nix) ];
}); });
mkHomeConfig = ({system, username ? "ttm" }: home-manager.lib.homeManagerConfiguration { mkHomeConfig = ({system, username ? "ttm" }: home-manager.lib.homeManagerConfiguration {
@@ -40,6 +35,7 @@
}); });
in in
utils.lib.eachDefaultSystem (system: { utils.lib.eachDefaultSystem (system: {
packages.codex-acp = (pkgsForSystem system).codex-acp;
legacyPackages.homeConfigurations.std = mkHomeConfig { inherit system; }; legacyPackages.homeConfigurations.std = mkHomeConfig { inherit system; };
}); });
} }
+3 -1
View File
@@ -10,7 +10,7 @@
programs.home-manager.enable = true; programs.home-manager.enable = true;
# Enable integration with generic Linux OSs # Enable integration with generic Linux OSs
targets.genericLinux.enable = pkgs.stdenv.isLinux; targets.genericLinux.enable = pkgs.stdenv.hostPlatform.isLinux;
home.packages = with pkgs; [ home.packages = with pkgs; [
# Better cat # Better cat
@@ -28,6 +28,8 @@
roboto-mono roboto-mono
sops sops
just just
codex
codex-acp
]; ];
imports = [ imports = [
-1
View File
@@ -13,7 +13,6 @@ in
epkgs.melpaPackages.jinx epkgs.melpaPackages.jinx
])) ]))
zstd zstd
emacs-lsp-booster
aspell aspell
]; ];
# Macs need coreutils for dired to work # Macs need coreutils for dired to work
+2 -2
View File
@@ -2,10 +2,10 @@
{ {
programs.git = { programs.git = {
enable = true; enable = true;
aliases = { settings = {
alias = {
lg = "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"; lg = "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit";
}; };
extraConfig = {
user.name = "Tim McCarthy"; user.name = "Tim McCarthy";
user.email = "thoomfish@gmail.com"; user.email = "thoomfish@gmail.com";
color.ui = true; color.ui = true;
+3
View File
@@ -0,0 +1,3 @@
final: prev: {
codex-acp = final.callPackage ../packages/codex-acp.nix { };
}
+25
View File
@@ -0,0 +1,25 @@
{ lib, buildNpmPackage, fetchFromGitHub }:
# The nixpkgs package still builds the Rust adapter. Version 1.x uses Node
# and ships a compatible Codex CLI through its locked npm dependencies.
buildNpmPackage (finalAttrs: {
pname = "codex-acp";
version = "1.10.0";
src = fetchFromGitHub {
owner = "agentclientprotocol";
repo = "codex-acp";
tag = "v${finalAttrs.version}";
hash = "sha256-D8uYd30NRXQYUSBFCi66Oq0iRZXpl8P7nWv2m3+KBig=";
};
npmDepsHash = "sha256-df1/kPiZFBEq9Um26Qbo9XaYj2J8BOXQmunCQWquDTo=";
meta = {
description = "ACP adapter for Codex CLI";
homepage = "https://github.com/agentclientprotocol/codex-acp";
license = lib.licenses.asl20;
mainProgram = "codex-acp";
platforms = [ "aarch64-darwin" "x86_64-darwin" "aarch64-linux" "x86_64-linux" ];
};
})