help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: call-process writing to the wrong buffer


From: Joost Kremers
Subject: Re: call-process writing to the wrong buffer
Date: Wed, 02 Nov 2016 12:41:24 +0100
User-agent: mu4e 0.9.17; emacs 25.1.50.3


On Wed, Nov 02 2016, Matthias Pfeifer wrote:
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.

You probably want:

(call-process "openssl" nil (list openssl-buffer t) t "x509" "-text" "-noout" "-in" cert-file)

(Swap third and fourth argument.)

--
Joost Kremers
Life has its moments



reply via email to

[Prev in Thread] Current Thread [Next in Thread]