Function: actypes::exec-window-cmd
actypes::exec-window-cmd is an interactive and byte-compiled function
defined in hactypes.el.
Signature
(actypes::exec-window-cmd SHELL-CMD)
Documentation
Asynchronously execute an external window-based SHELL-CMD string.
Key Bindings
Source Code
;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hactypes.el
(defact exec-window-cmd (shell-cmd)
"Asynchronously execute an external window-based SHELL-CMD string."
(interactive
(let ((default (car hargs:defaults)))
(list (hargs:read "Shell cmd: "
(lambda (cmd) (not (string-equal cmd "")))
default "Enter a shell command." 'string))))
(require 'comint)
(let* ((buf-name "*Hyperbole Shell*")
(default-dir (expand-file-name default-directory))
(cmd (if (hpath:remote-p default-dir)
(concat "(" shell-cmd ") &")
(concat "(cd " default-dir " && " shell-cmd ") &")))
(msg (format "Executing: %s" shell-cmd)))
(message msg)
(save-excursion
(save-window-excursion
(unless (and (get-buffer buf-name)
(get-buffer-process (get-buffer buf-name)))
(save-excursion
(save-window-excursion
(setq buf-name (buffer-name (shell buf-name)))))
(message msg)
;; Wait for shell to startup before sending it input.
(sit-for 1)
(set-buffer buf-name)
(setq comint-last-input-start (point-marker)
comint-last-input-end (point-marker)))
(unless (equal (buffer-name (current-buffer)) buf-name)
(set-buffer buf-name))
(goto-char (point-max))
(insert cmd)
(comint-send-input)))
(message msg)))