all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* read user input in compilation buffer
@ 2012-12-19 16:47 hemant
  2012-12-19 19:16 ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: hemant @ 2012-12-19 16:47 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 844 bytes --]

Hello Folks,

I often run my tests (RSpec if you will) from Emacs using a customized
version of compile command. It works beautifully and all that.

But sometimes some special line in my code triggers something that reads
from user input. If you have heard of this Ruby gem Pry. When I run the
tests from Emacs and code being run contains binding.pry() it opens pry
prompt at the point, the method is encountered.

Now I understand that, there are some emacs-pry integrations out there, but
I want something simple, something that will simply let me type things in
the buffer when user input is required, in compile buffer.

Is it possible at all?



-- 
Let them talk of their oriental summer climes of everlasting
conservatories; give me the privilege of making my own summer with my own
coals.

http://gnufied.org
http://twitter.com/gnufied

[-- Attachment #2: Type: text/html, Size: 1135 bytes --]

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

* Re: read user input in compilation buffer
       [not found] <mailman.15684.1355935693.855.help-gnu-emacs@gnu.org>
@ 2012-12-19 17:27 ` William Gardella
  0 siblings, 0 replies; 5+ messages in thread
From: William Gardella @ 2012-12-19 17:27 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

hemant <gethemant@gmail.com> writes:

> Hello Folks,
>
> I often run my tests (RSpec if you will) from Emacs using a
> customized version of compile command. It works beautifully and all
> that.
>
> But sometimes some special line in my code triggers something that
> reads from user input. If you have heard of this Ruby gem Pry. When I
> run the tests from Emacs and code being run contains binding.pry() it
> opens pry prompt at the point, the method is encountered.
>
> Now I understand that, there are some emacs-pry integrations out
> there, but I want something simple, something that will simply let me
> type things in the buffer when user input is required, in compile
> buffer.
>
> Is it possible at all?

A lazy way would be to consider using async-shell-command instead of
compilation-mode.  `async-shell-command' does prompt for user input via
the minibuffer if it detects that the command is waiting for user
input.  Generally works well, and you can even get nice colorized output
if `ansi-color-for-comint-mode' is non-nil.

-- 
WGG
I use grml (http://grml.org/)


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

* Re: read user input in compilation buffer
  2012-12-19 16:47 read user input in compilation buffer hemant
@ 2012-12-19 19:16 ` Stefan Monnier
  2012-12-19 21:10   ` Peter Dyballa
  2012-12-20  5:04   ` hemant
  0 siblings, 2 replies; 5+ messages in thread
From: Stefan Monnier @ 2012-12-19 19:16 UTC (permalink / raw)
  To: help-gnu-emacs

> Now I understand that, there are some emacs-pry integrations out there, but
> I want something simple, something that will simply let me type things in
> the buffer when user input is required, in compile buffer.

You can ask compile to run the process in a comint buffer.
And you can also write a little function that lets you send text to
the process.  Such as:

   (defun my-send-string-to-process (string)
     (interactive (list (read-string "Input: ")))
     (process-send-string (get-buffer-process) (concat string "\n")))

If such user-input is only needed occasionally, it may be simpler to M-x
my-send-string-to-process RET then to configure your compilation command to
always use comint.


        Stefan




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

* Re: read user input in compilation buffer
  2012-12-19 19:16 ` Stefan Monnier
@ 2012-12-19 21:10   ` Peter Dyballa
  2012-12-20  5:04   ` hemant
  1 sibling, 0 replies; 5+ messages in thread
From: Peter Dyballa @ 2012-12-19 21:10 UTC (permalink / raw)
  To: Stefan Monnier, hemant; +Cc: help-gnu-emacs


Am 19.12.2012 um 20:16 schrieb Stefan Monnier:

> You can ask compile to run the process in a comint buffer.
> And you can also write a little function that lets you send text to
> the process.

I'm just using send-invisible… (which is OK for short strings while larger ones could be inserted from registers in which these "texts" were saved before)

--
Greetings

  Pete

I consider religion godesque.





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

* Re: read user input in compilation buffer
  2012-12-19 19:16 ` Stefan Monnier
  2012-12-19 21:10   ` Peter Dyballa
@ 2012-12-20  5:04   ` hemant
  1 sibling, 0 replies; 5+ messages in thread
From: hemant @ 2012-12-20  5:04 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 405 bytes --]

Hi,

On Thu, Dec 20, 2012 at 12:46 AM, Stefan Monnier
<monnier@iro.umontreal.ca>wrote:

> > Now I understand that, there are some emacs-pry integrations out there,
> but
> > I want something simple, something that will simply let me type things in
> > the buffer when user input is required, in compile buffer.
>
> You can ask compile to run the process in a comint buffer.
>

That did the trick. Thanks.

[-- Attachment #2: Type: text/html, Size: 854 bytes --]

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

end of thread, other threads:[~2012-12-20  5:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-19 16:47 read user input in compilation buffer hemant
2012-12-19 19:16 ` Stefan Monnier
2012-12-19 21:10   ` Peter Dyballa
2012-12-20  5:04   ` hemant
     [not found] <mailman.15684.1355935693.855.help-gnu-emacs@gnu.org>
2012-12-19 17:27 ` William Gardella

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.