[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Inserting output from a program into a buffer
From: |
Pascal J. Bourguignon |
Subject: |
Re: Inserting output from a program into a buffer |
Date: |
Sun, 21 Feb 2010 17:26:06 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1 (darwin) |
Tim Johnson <tim@johnsons-web.com> writes:
> emacs 22.3.1 on slack 13.0/32-bit
>
> Consider the following text:
>
> [[10:00 11:27][14:43 14:57]] ;; ^output here
>
> Given that I have selected:
> "[[10:00 11:27][14:43 14:57]]"
> as a region, I would like to send that region to an external application
> and insert the output as indicated.
>
> I've recently started using emacs again after several years, and have in
> the past written quite a few elisp functions and keybindings for my own
> use. The external application has already been written, I've used it
> with vim and "r !<shell command>" for years.
>
> References to relevant and related elisp functions and scripts would
> probably be sufficient, however, if someone has done this already - why
> re-invent the wheel?
(defvar *my-command* "echo -n AAA ; cat ; echo -n ZZZ")
(defun my-process-region (start end)
(interactive "r")
(let ((output-buffer (get-buffer-create " *My Process Output*")))
(with-current-buffer output-buffer (erase-buffer))
(shell-command-on-region start end *my-command* output-buffer nil)
(goto-char end)
(insert (format " ;; %s" (with-current-buffer output-buffer
(buffer-substring (point-min) (point-max)))))))
[[10:00 11:27][14:43 14:57]] ;; AAA[[10:00 11:27][14:43 14:57]]ZZZ
--
__Pascal Bourguignon__
- Re: Inserting output from a program into a buffer, (continued)
- Re: Inserting output from a program into a buffer, Pascal J. Bourguignon, 2010/02/21
- Re: Inserting output from a program into a buffer, Tim Johnson, 2010/02/22
- Re: Inserting output from a program into a buffer, Pascal J. Bourguignon, 2010/02/22
- Re: Inserting output from a program into a buffer, Tim Johnson, 2010/02/22
- Re: Inserting output from a program into a buffer, Pascal J. Bourguignon, 2010/02/22
- Re: Inserting output from a program into a buffer, Tim Johnson, 2010/02/22
- Re: Inserting output from a program into a buffer, jpkotta, 2010/02/22
- Re: Inserting output from a program into a buffer, Tim X, 2010/02/22
- Re: Inserting output from a program into a buffer, tomas, 2010/02/21
- Re: Inserting output from a program into a buffer, Tim Landscheidt, 2010/02/21
Re: Inserting output from a program into a buffer,
Pascal J. Bourguignon <=