From 305d1c5931a25f36bd2ba89b77971773b0de7ac4 Mon Sep 17 00:00:00 2001 From: jao Date: Thu, 27 Jan 2022 22:40:23 +0000 Subject: nits --- init.org | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'init.org') diff --git a/init.org b/init.org index 3994cb4..f5db464 100644 --- a/init.org +++ b/init.org @@ -1814,18 +1814,15 @@ (term-send-string nil (concat cmd " ; exit\n")))) (defmacro jao-def-exec-in-term (name cmd &rest prelude) - `(defun ,(intern (format "jao-term-%s" name)) () - (interactive) + `(defun ,(intern (format "jao-term-%s" name)) (&optional term) + (interactive "P") ,@prelude - (if-let ((b (jao-term--find ,cmd))) - (pop-to-buffer b) - (jao-exec-in-term ,cmd ,(format "*%s*" name)) - (setq-local jao-term--cmd ,cmd)))) + (let ((jao-use-vterm (if term (not jao-use-vterm) jao-use-vterm))) + (if-let ((b (jao-term--find ,cmd))) + (pop-to-buffer b) + (jao-exec-in-term ,cmd ,(format "*%s*" name)) + (setq-local jao-term--cmd ,cmd))))) - (jao-def-exec-in-term "aptitude" "aptitude" (jao-afio--goto-scratch)) - (jao-def-exec-in-term "htop" "htop" (jao-afio--goto-scratch)) - (jao-def-exec-in-term "spt" "spt" (jao-afio--goto-scratch)) - (jao-def-exec-in-term "ncmpcpp" "ncmpcpp" (jao-afio--goto-scratch)) #+end_src *** eshell ***** Basic custom @@ -2920,6 +2917,8 @@ (defalias 'jao-spotify-artist #'consult-spotify-artist) (defalias 'jao-spotify-playlist #'consult-spotify-playlist) + (jao-def-exec-in-term "ncmpcpp" "ncmpcpp" (jao-afio--goto-scratch)) + (use-package jao-mpris :demand t :config @@ -2959,6 +2958,8 @@ (defun jao-spt-on-p () jao-spt-on) (jao-spt-setup-aliases) + (jao-def-runner jao-term-spt 0 "spt" "xterm" "-e" "spt") + (defun jao-spotify-toggle-player () (interactive) (if jao-spt-on (jao-mpris-setup-aliases) (jao-spt-setup-aliases)) @@ -3038,6 +3039,9 @@ (use-package jao-random-album :demand t) + (jao-def-exec-in-term "aptitude" "aptitude" (jao-afio--goto-scratch)) + (jao-def-exec-in-term "htop" "htop" (jao-afio--goto-scratch)) + (transient-define-prefix jao-transient-spotify () [:description (lambda () (format "Spotify using %s" (if jao-spt-on "spt" "MPRIS"))) -- cgit v1.2.3