I frequently have to look into a binary file and want to
translate it into
text by using an external program. I came up with this snippet
from which I
had expected that it opens a new buffer, selects that buffer and
writes
into it the output of this external program:
(defun mp/show-x509 ()
(interactive)
(let ((cert-file (buffer-file-name))
(right-window (split-window-right))
(openssl-buffer (generate-new-buffer
(generate-new-buffer-name
"*openssl*"))))
(select-window right-window)
(set-window-buffer nil openssl-buffer)
(call-process "openssl" nil t (list openssl-buffer t) "x509"
"-text"
"-noout" "-in" cert-file)))
However I must have some misunderstanding here. The output of
call-process
is in fact inserted into the window on the left (left when
assuming there
is only one window in the frame when caling mp/show-x509). And I
really do
not have a clue whats wrong.