From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ishi soichi Newsgroups: gmane.emacs.help Subject: executing Ruby from Emacs buffer Date: Thu, 10 May 2012 19:28:58 +0900 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=0015174be9726d4f7804bfac16cd X-Trace: dough.gmane.org 1336645759 21030 80.91.229.3 (10 May 2012 10:29:19 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 10 May 2012 10:29:19 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu May 10 12:29:19 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SSQcY-0000Eh-TJ for geh-help-gnu-emacs@m.gmane.org; Thu, 10 May 2012 12:29:19 +0200 Original-Received: from localhost ([::1]:51561 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SSQcY-0003tx-78 for geh-help-gnu-emacs@m.gmane.org; Thu, 10 May 2012 06:29:18 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:59557) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SSQcN-0003tg-Ox for help-gnu-emacs@gnu.org; Thu, 10 May 2012 06:29:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SSQcH-0004iL-AI for help-gnu-emacs@gnu.org; Thu, 10 May 2012 06:29:07 -0400 Original-Received: from mail-ey0-f169.google.com ([209.85.215.169]:39080) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SSQcH-0004i2-1G for help-gnu-emacs@gnu.org; Thu, 10 May 2012 06:29:01 -0400 Original-Received: by eaan1 with SMTP id n1so482579eaa.0 for ; Thu, 10 May 2012 03:28:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=6KJET+Sg8x/ZE2ZrhFGDEWUs+/F1dpansT6MT3xeF9Q=; b=B1PLhV7hEtT+UlaOoZnfC99l4KS17zKuwSwhQ0/WhaGPyRgowVTmy/RrV0IvPlkYjp HtpI2QsN7/6dmbnKOZ1Y5+nb/sp0q8pUDL5Plq5LgqQZW0+4+KM+y2D+dlJTqNsLKh3p uCxFY5hQMFO5yul7XkL31VT0IRX14QnRMH/q4PkD6ueG6y4Dx4HSHz4e6qNSWidxCAsg cPd701WYFJ9aW55HAgQ8MVr6F3IBQLDrrBoKKTj/2+TN6/YQp3M2Xbbbn0fOcNFsiLdd vnUTY4J59GoW9yviWkbmfbG1cIeltQ+LHxkWki0XwvKqu32qqk907AtJbQP4M9F68HsD 0blg== Original-Received: by 10.213.22.70 with SMTP id m6mr1255175ebb.23.1336645738385; Thu, 10 May 2012 03:28:58 -0700 (PDT) Original-Received: by 10.14.187.133 with HTTP; Thu, 10 May 2012 03:28:58 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.215.169 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 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.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:84790 Archived-At: --0015174be9726d4f7804bfac16cd Content-Type: text/plain; charset=ISO-8859-1 Cococa Emacs 23.2 GNU Emacs 23.2.1 (x86_64-apple-darwin10.4.0, NS apple-appkit-1038.32) of 2010-08-27 ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin10.8.0] I am not sure if this question is to be asked here, but I'll try. I'm trying to run Ruby codes from Emacs. (defun execute-ruby () (interactive) (let (buf) (setq buf (get-buffer-create "*result ruby execution*")) (call-process-region (region-beginning) (region-end) "ruby" nil buf nil) (display-buffer buf))) as you can see, this piece of Elisp code runs a region where Ruby code is written. # -*- encoding: utf-8 -*- require 'twitter' Twitter.configure do |config| config.consumer_key = '' config.consumer_secret = '' config.oauth_token = '' config.oauth_token_secret = '' end p Twitter.user_timeline("soujiro0725").first.text The Ruby code utilizes a gem library, called 'twitter', which enables to tweet or get timelines by writing simple codes. Of course, this particular gem library is installed and it perfectly runs in a regular shell, such as zsh or bash. But for some reason, it gives an error when executed in Emacs buffer. ruby_twitter.rb:2:in `require': no such file to load -- twitter (LoadError) from ruby_twitter.rb:2 Looks like Emacs cannot find the gem library. How can I have Emacs find the proper library or gems? soichi --0015174be9726d4f7804bfac16cd Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cococa Emacs 23.2
GNU Emacs 23.2.1 (x86_64-apple-darwin10.4.0, NS apple= -appkit-1038.32) of 2010-08-27
ruby 1.9.3p0 (2011-10-30 revisi= on 33570) [x86_64-darwin10.8.0]

I am n= ot sure if this question is to be asked here, but I'll try.

I'm trying to run Ruby codes from Emacs.
=
(defun execute-ruby ()
=A0 (interactive)
=A0 (let (buf)
=A0 =A0 (setq buf
=A0(get-buffer-create &qu= ot;*result ruby execution*"))
=A0 =A0 (call-process-region
=A0 =A0 =A0(region-beginning) (= region-end) "ruby" nil buf nil)
=A0 =A0 (display-buffer= buf)))

as you can see, this piece of Elisp = code runs a region where Ruby code is written.

# -*- encoding: utf-8 -*-
require 't= witter'
Twitter.configure do |config|
=A0 config.co= nsumer_key =3D ''
=A0 config.consumer_secret =3D '= 9;
=A0 config.oauth_token =3D ''
=A0 config.oauth_token= _secret =3D ''
end
p Twitter.user_timeline(&quo= t;soujiro0725").first.text


The Ruby code utilizes a gem library, called 'twitter', which en= ables to tweet or get timelines by writing simple codes.
Of course, this particular gem library is installed and it perfectly r= uns in a regular shell, such as zsh or bash.

But f= or some reason, it gives an error when executed in Emacs buffer.

ruby_twitter.rb:2:in `require': no such file to loa= d -- twitter (LoadError)
from ruby_twitter.rb:2

<= div> Looks like Emacs cannot find the gem library.

How = can I have Emacs find the proper library or gems?

= soichi
--0015174be9726d4f7804bfac16cd--