From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Luca Ferrari Newsgroups: gmane.emacs.help Subject: shell-command-on-region but with command line arguments Date: Mon, 7 Nov 2022 16:51:43 +0100 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33878"; mail-complaints-to="usenet@ciao.gmane.io" To: help-gnu-emacs Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Mon Nov 07 16:52:47 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 1os4QZ-0008gB-4V for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 07 Nov 2022 16:52:47 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1os4QC-0006yv-F1; Mon, 07 Nov 2022 10:52:24 -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 1os4QB-0006yW-0C for help-gnu-emacs@gnu.org; Mon, 07 Nov 2022 10:52:23 -0500 Original-Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1os4Q9-0001MB-EE for help-gnu-emacs@gnu.org; Mon, 07 Nov 2022 10:52:22 -0500 Original-Received: by mail-wm1-x333.google.com with SMTP id o30so7155891wms.2 for ; Mon, 07 Nov 2022 07:52:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=cXa4c/Fx8Mxwn+iCfpT2HlVfvuIQ20cEXNpOOt22wnw=; b=eQzcdjIvB7s/SCuZkf8xrCPCm5uzrZB3eDRSFxLCnpxRPg6yxmkBDoCc1DuvpyYKBo O8DHoLaspbyA2g5Sqfha68nQk2H19zSWHlQsWo6AarWRm1BzWH/cjx31yzkrk6x3DoKD TYnTA9wkBEoHw6MzYJNp7EUqM0FRq7yrQ6OYLBT+GeJnLEoaiAGhIL3XMP4w4I1buLOf FVTbB9FfRuiM8tyWUJEdaLWCrgZSb+sQaIHxWwWPzFCfrlXPgGWnEvO4cIsTJdjxVqyR mIQZZ3aZQZsJxjm9TIKhKVAiATcGsJ/nPYTmFtrXsDnROU+/lJyoiVMqVmM30eZVJEmU pUMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=cXa4c/Fx8Mxwn+iCfpT2HlVfvuIQ20cEXNpOOt22wnw=; b=z8xyJ7QWYtG2ADZqw9Gcn9pu3GlyopY3ogvuKplJ+JtDFLKcXJZhfQA0ZixO+z2UL+ QoLbVbo+5j1jCVZ9w5hu+j0oEVC/BLkhnD9ZMFMBxLySzF4ZIE+k0JokCkgn9t5cL+PM eZxK8wODu+CG179RjIqS5mxYpu8zAmdp/GAY0eiYejrdNq648z3OO4loq0a138FFZGxz ZLOuq0SM8vfclF44hi5w0wvZ1XGUgg5ABqBSpTVzLG+qJ6a9FDfgcFYLbV8avLCcYCVW 1w1i8UbgJB4WPIPgosld9GwwuINFqHQMbnvzvRRUaahu04Ibqr1WREc4hKT5o0bNHF0a 2sgQ== X-Gm-Message-State: ACrzQf3/dJo9cKo6B8WWplt0SXnRDCwBGhuxoXhpTqldaPxsWwLBUFta sWRRuf29/j4p2pFLLQT64C0CRxHJ6j3zKPicYAxOlonkPTY= X-Google-Smtp-Source: AMsMyM5Hc0QhBOImhTPYTF4HCD9eXyCudLtfzicnbCnx+VRAJdr/VBlRjAzUidQjJjuyAEWgrJ3PfPDMH1+9dLLVrBw= X-Received: by 2002:a05:600c:2150:b0:3cf:6c05:b4ab with SMTP id v16-20020a05600c215000b003cf6c05b4abmr31401402wml.161.1667836339367; Mon, 07 Nov 2022 07:52:19 -0800 (PST) Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=fluca1978@gmail.com; helo=mail-wm1-x333.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 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_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=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:140788 Archived-At: Hi all, I'm trying to configure my Perl environment to be able to run the buffer I'm editing, so I created a function to run shell-command-on-region and bound to C-c r: (defun fluca1978/run-perl-on-region () "A function to invoke Perl on the current region or buffer. If a region is active, the perl interpreter will be executed on such a region; otherwise if no region is active, the interpreter will be executed against the whole buffer." (interactive) (let ((b (if mark-active (min (point) (mark)) (point-min))) (e (if mark-active (max (point) (mark)) (point-max))) (perl "perl" )) (shell-command-on-region b e perl))) ;; bind the function to run when ;; C-c r ;; in cperl-mode is hit (eval-after-load "cperl-mode" '(progn (define-key cperl-mode-map (kbd "C-c r") 'fluca1978/run-perl-on-region))) So far, so good, it works for me. I was wondering if there's a way to prompt me for optional command line arguments, so that the command should run against the buffer/region followed by a list of arguments. Any idea? Thanks, Luca