all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* call-process writing to the wrong buffer
@ 2016-11-02 11:30 Matthias Pfeifer
  2016-11-02 11:41 ` Joost Kremers
  0 siblings, 1 reply; 3+ messages in thread
From: Matthias Pfeifer @ 2016-11-02 11:30 UTC (permalink / raw)
  To: help-gnu-emacs

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.

matthias


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: call-process writing to the wrong buffer
  2016-11-02 11:30 call-process writing to the wrong buffer Matthias Pfeifer
@ 2016-11-02 11:41 ` Joost Kremers
  2016-11-02 17:43   ` Matthias Pfeifer
  0 siblings, 1 reply; 3+ messages in thread
From: Joost Kremers @ 2016-11-02 11:41 UTC (permalink / raw)
  To: Matthias Pfeifer; +Cc: help-gnu-emacs


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



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: call-process writing to the wrong buffer
  2016-11-02 11:41 ` Joost Kremers
@ 2016-11-02 17:43   ` Matthias Pfeifer
  0 siblings, 0 replies; 3+ messages in thread
From: Matthias Pfeifer @ 2016-11-02 17:43 UTC (permalink / raw)
  To: help-gnu-emacs

I was overlooking the obvious...

Many thanks!


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-11-02 17:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-02 11:30 call-process writing to the wrong buffer Matthias Pfeifer
2016-11-02 11:41 ` Joost Kremers
2016-11-02 17:43   ` Matthias Pfeifer

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.