From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Joost Kremers Newsgroups: gmane.emacs.help Subject: Re: call-process writing to the wrong buffer Date: Wed, 02 Nov 2016 12:41:24 +0100 Message-ID: <87mvhi6rdn.fsf@fastmail.fm> References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; format=flowed X-Trace: blaine.gmane.org 1478086968 12674 195.159.176.226 (2 Nov 2016 11:42:48 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 2 Nov 2016 11:42:48 +0000 (UTC) User-Agent: mu4e 0.9.17; emacs 25.1.50.3 Cc: help-gnu-emacs@gnu.org To: Matthias Pfeifer Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Nov 02 12:42:44 2016 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c1tvi-0006cG-4Q for geh-help-gnu-emacs@m.gmane.org; Wed, 02 Nov 2016 12:42:06 +0100 Original-Received: from localhost ([::1]:54373 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c1tvk-0004yc-JZ for geh-help-gnu-emacs@m.gmane.org; Wed, 02 Nov 2016 07:42:08 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58237) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c1tvE-0004yG-Cw for help-gnu-emacs@gnu.org; Wed, 02 Nov 2016 07:41:37 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c1tvB-0008MA-6U for help-gnu-emacs@gnu.org; Wed, 02 Nov 2016 07:41:36 -0400 Original-Received: from out2-smtp.messagingengine.com ([66.111.4.26]:53204) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1c1tvB-0008LN-20 for help-gnu-emacs@gnu.org; Wed, 02 Nov 2016 07:41:33 -0400 Original-Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 826D5204CA; Wed, 2 Nov 2016 07:41:31 -0400 (EDT) Original-Received: from frontend1 ([10.202.2.160]) by compute2.internal (MEProxy); Wed, 02 Nov 2016 07:41:31 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.fm; h= x-me-sender:x-sasl-enc:references:from:to:cc:subject:in-reply-to :date:message-id:mime-version:content-type; s=mesmtp; bh=+qePVar tB3oUXWxp03rsHUPzwbU=; b=dPOw3wFFqCWK/w04LfyQxXJlb4HIshEDBbbrD2A 4so/iUrkELqSoaZ1vU14E4022rl6qZ5YJaN1iPZDhHx3+kDbIp8xfO09QOqyjQ2Q L+Plkca8Mm7x5M6AniwBvN3grKUUKI0REae4QH8LfRxtGy/hwFEFUxFU4JDvLmLk TbGA= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=x-me-sender:x-sasl-enc:references:from:to :cc:subject:in-reply-to:date:message-id:mime-version :content-type; s=smtpout; bh=+qePVartB3oUXWxp03rsHUPzwbU=; b=rXd PXcHH0J8VAX24A6UZrRB+z9cVnQTFgQW3pLxlPEqa8EUzzxWSEVmolTl9OdM76ES r7pzuoJC61qRw0c64ugH+lN5TnewAtxSFAYFbywhNCVjEB1KDtmnJuavUeAA2rZb T2v2cIWqB85UXXo+NZ3ZWNY867v5O4iGdO1ye2ZE= X-ME-Sender: X-Sasl-enc: 3dGDg1DX5vzFsyzySfi8HPsMLiaN9D4L6jxFD2WIhBgZ 1478086891 Original-Received: from IdeaPad.messagingengine.com (x4d0ac728.dyn.telefonica.de [77.10.199.40]) by mail.messagingengine.com (Postfix) with ESMTPA id CCF2BF29CD; Wed, 2 Nov 2016 07:41:30 -0400 (EDT) In-reply-to: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.26 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:111651 Archived-At: 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