all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* shell-command-on-region but with command line arguments
@ 2022-11-07 15:51 Luca Ferrari
  2022-11-07 17:22 ` Emanuel Berg
  2022-11-07 19:21 ` Bruno Barbier
  0 siblings, 2 replies; 8+ messages in thread
From: Luca Ferrari @ 2022-11-07 15:51 UTC (permalink / raw)
  To: help-gnu-emacs

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



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

end of thread, other threads:[~2022-11-09 11:40 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-07 15:51 shell-command-on-region but with command line arguments Luca Ferrari
2022-11-07 17:22 ` Emanuel Berg
2022-11-07 19:21 ` Bruno Barbier
2022-11-08  0:13   ` Emanuel Berg
2022-11-09  7:21   ` Luca Ferrari
2022-11-09  7:53     ` Bruno Barbier
2022-11-09 10:37       ` Emanuel Berg
2022-11-09 11:40       ` Luca Ferrari

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.