Integrated repository, worktree, git stacker, and project manager
0

Configure Feed

Select the types of activity you want to include in your feed.

pm-agent.el: add ghostel dispatcher for pm-agent

Bracketed-pastes the shell-quoted argv into a `ghostel` buffer and
sends Return, alongside the existing term/vterm dispatchers.

Jordan Isaacs (Apr 27, 2026, 5:54 PM UTC) 0573fd01 08c4455a

+39 -5
+38 -5
integrations/emacs/pm-agent.el
··· 13 13 ;; :session-id "..." 14 14 ;; :project "kms") 15 15 ;; 16 - ;; Two opt-in dispatchers ship with this file: 17 - ;; - `pm-agent-dispatch-term' (built-in `term-mode') 18 - ;; - `pm-agent-dispatch-vterm' (requires the `vterm' package) 16 + ;; Three opt-in dispatchers ship with this file: 17 + ;; - `pm-agent-dispatch-term' (built-in `term-mode') 18 + ;; - `pm-agent-dispatch-vterm' (requires the `vterm' package) 19 + ;; - `pm-agent-dispatch-ghostel' (requires the `ghostel' package) 19 20 ;; 20 21 ;; Default behavior (`pm-agent-dispatch-function' = nil) stages the 21 22 ;; command on the kill-ring and prints a hint, so the package is ··· 43 44 (declare-function term-mode "term" ()) 44 45 (declare-function term-char-mode "term" ()) 45 46 47 + (defvar ghostel-buffer-name) ; declared dynamic so the let-binding takes effect 48 + (declare-function ghostel "ext:ghostel" (&optional arg)) 49 + (declare-function ghostel-paste-string "ext:ghostel" (string)) 50 + (declare-function ghostel-send-key "ext:ghostel" (key-name &optional mods)) 51 + 46 52 ;;;; Dispatch defcustom 47 53 48 54 ;;;###autoload ··· 54 60 the kill-ring and prints a message instead of launching anything. 55 61 56 62 Set to one of the built-in dispatchers shipped with this file: 57 - - `pm-agent-dispatch-term' (uses Emacs's built-in `term-mode') 58 - - `pm-agent-dispatch-vterm' (requires the `vterm' package) 63 + - `pm-agent-dispatch-term' (uses Emacs's built-in `term-mode') 64 + - `pm-agent-dispatch-vterm' (requires the `vterm' package) 65 + - `pm-agent-dispatch-ghostel' (requires the `ghostel' package) 59 66 or write your own — for example, to spawn an external terminal 60 67 emulator." 61 68 :type '(choice (const :tag "Disabled (kill-ring stage)" nil) ··· 149 156 (vterm)) 150 157 (vterm-send-string (mapconcat #'shell-quote-argument argv " ")) 151 158 (vterm-send-return))) 159 + 160 + ;;;###autoload 161 + (defun pm-agent-dispatch-ghostel (plist) 162 + "Launch PLIST's `:argv' inside a `ghostel' buffer. 163 + 164 + Requires the `ghostel' package; raises `user-error' otherwise so 165 + users get a clear hint instead of a void-function backtrace. 166 + 167 + The argv is shell-quoted and forwarded via `ghostel-paste-string' 168 + (bracketed paste — the shell treats it as one atomic input even 169 + when it contains spaces or quotes), then a Return key is sent to 170 + execute it. Bracketed paste falls back to a raw write before the 171 + shell has set DECSET 2004; either way the shell receives the 172 + argv as a single command line." 173 + (unless (require 'ghostel nil t) 174 + (user-error "ghostel not installed; pick another `pm-agent-dispatch-function'")) 175 + (let* ((argv (plist-get plist :argv)) 176 + (cwd (plist-get plist :cwd)) 177 + (agent (plist-get plist :agent)) 178 + (project (plist-get plist :project)) 179 + (default-directory cwd) 180 + (ghostel-buffer-name (format "*pm-agent: %s/%s*" project agent)) 181 + (buf (ghostel))) 182 + (with-current-buffer buf 183 + (ghostel-paste-string (mapconcat #'shell-quote-argument argv " ")) 184 + (ghostel-send-key "return")))) 152 185 153 186 ;;;; Buffer + mode 154 187
+1
integrations/emacs/pm.el
··· 89 89 (autoload 'pm-agent-list-current-project "pm-agent" nil t) 90 90 (autoload 'pm-agent-dispatch-term "pm-agent" nil t) 91 91 (autoload 'pm-agent-dispatch-vterm "pm-agent" nil t) 92 + (autoload 'pm-agent-dispatch-ghostel "pm-agent" nil t) 92 93 93 94 (provide 'pm) 94 95