all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: jpkotta <jpkotta@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Inserting output from a program into a buffer
Date: Mon, 22 Feb 2010 15:06:15 -0800 (PST)	[thread overview]
Message-ID: <e36bc65c-73c7-48c8-8d3e-4d324965853e@m37g2000yqf.googlegroups.com> (raw)
In-Reply-To: slrnho3vpj.49k.tim@bart.johnson.com

On Feb 21, 10:45 pm, Tim Johnson <t...@johnsons-web.com> wrote:
> On 2010-02-22, Pascal J. Bourguignon <p...@informatimago.com> wrote:
> <..>> You could get a string without attribute using the function
> > buffer-substring-no-properties instead of buffer-substring.
>
>  Oh! Deja vu here... I believe that what I really need is
>  buffer-substring-<etc> to copy the region directly to a
>  variable.
>  thanks Pascal
>
> --
> Tim
> t...@johnsons-web.comhttp://www.akwebsoft.com

I wrote this a couple of weeks ago, and just extended it to work when
the region is active.

,----
| ;; see also C-u M-|
| (defun insert-from-shell-current-line ()
|   "Run the current line as a shell command, and put the output
|   immediately after it.  If the region is active, use for the
|   command."
|   (interactive "*")
|   (let ((start (line-beginning-position))
|         (stop (line-end-position)))
|     (when (region-active-p)
|       (setq start (region-beginning))
|       (setq stop (region-end)))
|     (goto-char stop)
|     (insert "\n")
|     (insert (shell-command-to-string
|              (buffer-substring start stop)))))
`----



  parent reply	other threads:[~2010-02-22 23:06 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-21  2:45 Inserting output from a program into a buffer Tim Johnson
2010-02-21  3:15 ` Tim Landscheidt
2010-02-21  4:45   ` Tim Johnson
2010-02-21  5:02     ` Barry Margolin
     [not found]       ` <slrnho2o6e.49k.tim@bart.johnson.com>
     [not found]         ` <87zl324774.fsf@lion.rapttech.com.au>
2010-02-22  0:45           ` Tim Johnson
2010-02-22  1:57             ` Pascal J. Bourguignon
2010-02-22  4:45               ` Tim Johnson
2010-02-22  9:41                 ` Pascal J. Bourguignon
2010-02-22 19:44                   ` Tim Johnson
2010-02-22 23:23                     ` Pascal J. Bourguignon
2010-02-23  0:44                       ` Tim Johnson
2010-02-22 23:06                 ` jpkotta [this message]
2010-02-22  7:22             ` Tim X
2010-02-21  6:28     ` tomas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e36bc65c-73c7-48c8-8d3e-4d324965853e@m37g2000yqf.googlegroups.com \
    --to=jpkotta@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.