Why does this command not print sometimes?

Table of Contents

Problem: emacs isn’t passing on the command output

My command doesn’t write when it’s executed by a keystroke or by `M-x`, but it does when I just evaluate it with `C-x C-e`. Nonetheless, both command actually WORK – they just don’t print. Why?

  (defun tsa/change-volume (amount-str) (interactive)
           (shell-command (concat "pactl set-sink-volume 0 " amount-str))
           (shell-command-to-string "pactl get-sink-volume 0")

; "Volume: front-left: 55865 /  85% / -4.16 dB,   front-right: 55865 /  85% / -4.16 dB
;        balance 0.00
;"
)

  (defun tsa/vol+ () (interactive)
         (tsa/change-volume "+5%"))
         ; (Shell command succeeded with no output)

https://www.reddit.com/r/emacs/comments/vxxyb8/comment/igpl2m3/?utm_source=share&utm_medium=web2x&context=3

Tory Anderson avatar
Tory Anderson
Web App Engineer, Digital Humanist, Researcher, Computer Psychologist