From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Bruno Barbier Newsgroups: gmane.emacs.help Subject: Re: shell-command-on-region but with command line arguments Date: Wed, 09 Nov 2022 08:53:46 +0100 Message-ID: <636b5b28.050a0220.b181b.e9bc@mx.google.com> References: <63695966.5d0a0220.15a40.29d3@mx.google.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26771"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-gnu-emacs To: Luca Ferrari Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Wed Nov 09 08:48:46 2022 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1osfpE-0006mx-MR for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 09 Nov 2022 08:48:44 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1osfoW-0007m6-H8; Wed, 09 Nov 2022 02:48:00 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1osfoT-0007kE-Qx for help-gnu-emacs@gnu.org; Wed, 09 Nov 2022 02:47:57 -0500 Original-Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1osfoS-0000S8-6U for help-gnu-emacs@gnu.org; Wed, 09 Nov 2022 02:47:57 -0500 Original-Received: by mail-wm1-x332.google.com with SMTP id v124-20020a1cac82000000b003cf7a4ea2caso664319wme.5 for ; Tue, 08 Nov 2022 23:47:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:date:references:in-reply-to:subject:cc:to:from :message-id:from:to:cc:subject:date:message-id:reply-to; bh=gwl/+wFow0lesGTFR5urQLhNUrX2KakWcjp0yXrRKH0=; b=idHoayDcW4xN+G/h7lGejEaCHh6FiMVVp8UMaxaZBnqpQYrVr6PYIU3+NmM25q9WO+ nYKnp9EBzQk9+GuO9R6Oj96iSDKO7H31H7xoNinfCiPY5B1QzXhJ21j9rGUkOwlev6Jo GAwaoc3wtx7mRQByVh/2wZsd4ti/qPOjE1Y+z3Np484R5SAnSmDKjLoHj29YKhsS+PWH Gft4huSuEWpmeDywPaYsTFOiaFeZLPH2AApVQz2ncITWtSR5VUGuE1h9nloQfifIdqIT 1ZDDzFOsrcsBZuw7j6jCc9WsniEm6VQODmg7MIzPvWcjmuzPFIashQNa9olQgF3SzZLS V8BQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:date:references:in-reply-to:subject:cc:to:from :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=gwl/+wFow0lesGTFR5urQLhNUrX2KakWcjp0yXrRKH0=; b=GAUqGzTLmCN8dNSOaQzF4wU+WRJDx0OmIpBPAZvEHQhwo8nEVDenlFWRZQvv2yEPkQ HHIJ1ruiY8qGdCEpY1XDE4MprwzzzHAZacfn0IzWtlWzvSf5vqkdrBrZXqT5I0abBv5/ 1+My8hsK1d7SCEQxFEaLBW8c7hrogiDJRUJoekjOk477sw1Q1eaOaTF19m/69pLiZb1X KTmiri3IpI0furrezXCZy/aOoUbQ9IZP+MJS868v2cxXMYsQg+SmQeMQqW3VaaPYHBRw b/JrV1fJJILv2FHV2EPRD1xLgvCsjIvregRjtVvvpb+W8pUjx/yClKs99ox1bZEOscPA UhvQ== X-Gm-Message-State: ACrzQf2Yv0qaS4LgxHKoCOXafTp3ef4fnsHCEaEQhs13sKXN5m2741Fn r2vfcSDLNmcFfDL6NOx3yxA= X-Google-Smtp-Source: AMsMyM5dhROrYxTa73ZLRnCuDfb0PVir+Q1wkAi39tHls0CZdwNB8bxZA2NxLij6kGDu7U2WfEYHJQ== X-Received: by 2002:a05:600c:3b21:b0:3c6:172:9c5a with SMTP id m33-20020a05600c3b2100b003c601729c5amr39678449wms.129.1667980072682; Tue, 08 Nov 2022 23:47:52 -0800 (PST) Original-Received: from tosh-laptop ([2a01:e0a:505:3460:1a16:a0c4:3f89:c0d9]) by smtp.gmail.com with ESMTPSA id bk28-20020a0560001d9c00b002365b759b65sm12595149wrb.86.2022.11.08.23.47.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Nov 2022 23:47:52 -0800 (PST) Original-Received: by tosh-laptop (sSMTP sendmail emulation); Wed, 09 Nov 2022 08:53:46 +0100 In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=brubar.cs@gmail.com; helo=mail-wm1-x332.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:140858 Archived-At: Luca Ferrari writes: > The problem is that I'm using (shell-command-on-region) that does not > allow me to insert arguments to the command, and I don't know how the > command is effectively invoked (e.g., piping the region to standard > input, using a temporary file) so I'm not able to "append" my > arguments. The command will receive the region as its standard input (see the help of the command shell-command-on-region): "Execute string COMMAND in inferior shell with region as input." Couldn't you just customize your own shell command string ? Something like: (defun my-on-region (where how) (interactive "sWhere: \nsHow: \n") (let ((b (if mark-active (min (point) (mark)) (point-min))) (e (if mark-active (max (point) (mark)) (point-max))) ;; Build a command that uses the arguments WHERE and ;; HOW, and also display the standard input. (perl (format "echo \"BEGIN Where=%s, How=%s\"; cat; echo \"\nEND\"" (shell-quote-argument where) (shell-quote-argument how)))) (shell-command-on-region b e perl))) Bruno