From 7606dec7e3a6cbf369052937c10f4b5d5e57b458 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Sun, 17 Oct 2021 19:05:43 +0200 Subject: Emacs: Complete launch-program function --- .emacs.d/init.el | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/.emacs.d/init.el b/.emacs.d/init.el index dc7f931..50b3ef2 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -86,10 +86,6 @@ (interactive) (kill-buffer)) -(defun launch-program (command) - (interactive (list (read-shell-command "Launch program: "))) - (start-process-shell-command command nil command)) - (defun sort-config-paragraphs () (interactive) (save-excursion @@ -116,8 +112,7 @@ (save-place-mode 1) (delete-selection-mode 1) -(set-keys "C-M-&" async-shell-command-here - "C-§" delete-other-windows +(set-keys "C-§" delete-other-windows "C-x C-b" ibuffer "C-x K" kill-buffer-now "C-c s c" sort-config-paragraphs @@ -142,8 +137,7 @@ ([?\C-v] . [next]) ([?\C-d] . [delete]) ([?\C-k] . [S-end delete]) - ([?\M-w] . [C-insert]) - ([?\C-y] . [S-insert]) + ([?\M-w] . [C-c]) ([?\M-f] . [C-right]) ([?\M-b] . [C-left]))) (setq exwm-input-global-keys '(("" . exwm-input-send-next-key))) @@ -270,6 +264,26 @@ the only window in the frame." ;; (require 'perspective) ;; (persp-mode) +;;; Processes +(defun launch-program (command) + (interactive (list (read-shell-command "Launch program: "))) + (make-process :name command + :buffer "*launch-program*" + :filter #'launch-program-filter + :command (list shell-file-name shell-command-switch command)) + (switch-to-buffer "*launch-program*") + (bury-buffer "*launch-program*")) +(defun launch-program-filter (proc string) + (when (buffer-live-p (process-buffer proc)) + (with-current-buffer (process-buffer proc) + (let ((moving (= (point) (process-mark proc)))) + (save-excursion + (goto-char (process-mark proc)) + (insert "<" (car (last (process-command proc))) "> " string) + (set-marker (process-mark proc) (point))) + (if moving (goto-char (process-mark proc))))))) +(set-keys "C-M-&" launch-program) + ;;; Undo-tree (require 'undo-tree) (global-undo-tree-mode 1) -- cgit v1.2.3