From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Marcelo de Moraes Serpa Newsgroups: gmane.emacs.help Subject: Re: Encoding error when calling a ruby script from Emacs using shell-command Date: Thu, 30 Aug 2012 12:41:08 -0500 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=20cf300fb1a12ff38204c87f2e93 X-Trace: ger.gmane.org 1346354809 15415 80.91.229.3 (30 Aug 2012 19:26:49 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 30 Aug 2012 19:26:49 +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 Aug 30 21:26:50 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 1T7AO9-0005d0-ET for geh-help-gnu-emacs@m.gmane.org; Thu, 30 Aug 2012 21:26:49 +0200 Original-Received: from localhost ([::1]:40527 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T7AO7-0003fJ-1D for geh-help-gnu-emacs@m.gmane.org; Thu, 30 Aug 2012 15:26:47 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:58213) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T78jw-00027t-SJ for help-gnu-emacs@gnu.org; Thu, 30 Aug 2012 13:41:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T78js-0007g3-Mz for help-gnu-emacs@gnu.org; Thu, 30 Aug 2012 13:41:12 -0400 Original-Received: from mail-qc0-f169.google.com ([209.85.216.169]:39374) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T78js-0007fK-HY for help-gnu-emacs@gnu.org; Thu, 30 Aug 2012 13:41:08 -0400 Original-Received: by qcsd16 with SMTP id d16so1757613qcs.0 for ; Thu, 30 Aug 2012 10:41:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=lypq1xpqTR3aOLwKKzXXQ68946xEWkCKmT3K51SzGoo=; b=P0EW1UgYEZlcX4eocL4IMFykyyIw4jdOAKTMrfPJrYPY/vFbPSuALfMmIsxhQawiie TgVCXYLVPlHc+io6eHG1a8zJUpCDqqhj3BL9L9GBEzRul1dS/0h7uiMJjeL4+ZAnw/rC UeINniulCy0xRezdN1VzWEur6WLOTgr9D6D2bGNDP95H89/OR1K/aaV5y848qj7ud7mw CD0iEIlrJvbZTgK8Z2qPy/16OgJn7M+vLn4PlooWszZ/qd1MExICiBlu67OUHYLQPwpa Wx/DSF4YH5GjOz8VxQeHkEfzab7O9fw8ckBGLNs3aTnSxpiWWYnUOAcGKtX7bD/IQ/Yi lNcQ== Original-Received: by 10.224.199.193 with SMTP id et1mr12511470qab.94.1346348468138; Thu, 30 Aug 2012 10:41:08 -0700 (PDT) Original-Received: by 10.49.37.196 with HTTP; Thu, 30 Aug 2012 10:41:08 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.216.169 X-Mailman-Approved-At: Thu, 30 Aug 2012 15:26:40 -0400 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:86595 Archived-At: --20cf300fb1a12ff38204c87f2e93 Content-Type: text/plain; charset=ISO-8859-1 By the way, I forgot to say that I have added the "(let (universal-coding-system-argument 'us-ascii-mac))" in an attempt to fix it, but it made no difference whatsoever. -Marcelo. On Thu, Aug 30, 2012 at 12:40 PM, Marcelo de Moraes Serpa < celoserpa@gmail.com> wrote: > Hi list, > > I have a small Ruby CLI program that I want to call from emacs. This > script simply opens an emacs orgmode file from a specific location in my > hard drive, and does some text processing. When I call it from the terminal > directly, it works fine. When I call it from emacs, the script fails with > an encoding error. > > I'm using this elisp to call it from emacs after a buffer is saved: > > (defun test () >> (let ((universal-coding-system-argument 'us-ascii-mac)) >> (shell-command "/Users/myself/.rvm/bin/rvm ruby-1.9.3-p194 do >> /usr/bin/myrubyscript") >> )) >> (add-hook 'after-save-hook 'test) > > > After I save a buffer, the shell-command function is fired, but I get the > following output in the "*Shell Command Output*" buffer: > > F, [2012-08-30T01:59:18.688827 #94004] FATAL -- : invalid byte sequence in >> US-ASCII (ArgumentError) >> /Users/myself/.rvm/gems/ruby-1.9.3-p194/gems/org-ruby-0.6.3/lib/org-ruby/parser.rb:89:in >> `split' >> /Users/myself/.rvm/gems/ruby-1.9.3-p194/gems/org-ruby-0.6.3/lib/org-ruby/parser.rb:89:in >> `initia > > > The strange thing is that the file that this script opens *is* accessible, > and is the same file it would open if it were fired up from the terminal. > For some reason, Emacs is getting in the way, but I have no idea what that > could be. Am I missing something? If someone could enlighten me here, I'd > be really grateful! > > Thanks in advance, > > - Marcelo. > > --20cf300fb1a12ff38204c87f2e93 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable By the way, I forgot to say that I have added the "(let (universal-cod= ing-system-argument 'us-ascii-mac))" in an attempt to fix it, but = it made no difference whatsoever.

-Marcelo.

On Thu, Aug 30, 2012 at 12:40 PM, Marcelo de Moraes Serpa <celoserpa@gma= il.com> wrote:
Hi list,

I have a small Ruby CLI program that I want to = call from emacs.=A0This script simply opens an emacs orgmode file from a sp= ecific location in my hard drive, and does some text processing.=A0When I c= all it from the terminal directly, it works fine. When I call it from emacs= , the script fails with an encoding error.

I'm using this elisp to call it from emacs after a = buffer is saved:

(defun test ()
=A0 (let ((universal-coding-system-argument 'us-ascii= -mac))
=A0 =A0 =A0 =A0 (shell-command =A0"/Users/myself/.rvm/bin/rv= m ruby-1.9.3-p194 do /usr/bin/myrubyscript")
=A0 =A0 ))
(add-hoo= k 'after-save-hook 'test)

After I save a buffer, the shell-command function= is fired, but I get the following output in the "*Shell Command Outpu= t*" buffer:

F, [2012-08-30T01:59:18.688827 #94004] FATAL -- : invalid byte sequence in = US-ASCII (ArgumentError)
/Users/myself/.rvm/gems/ruby-1.9.3-p194/gems/or= g-ruby-0.6.3/lib/org-ruby/parser.rb:89:in `split'
/Users/myself/.rvm= /gems/ruby-1.9.3-p194/gems/org-ruby-0.6.3/lib/org-ruby/parser.rb:89:in `ini= tia

The strange thing is that the file that this script ope= ns *is* accessible, and is the same file it would open if it were fired up = from the terminal. For some reason, Emacs is getting in the way, but I have= no idea what that could be. Am I missing something? If someone could enlig= hten me here, I'd be really grateful!

Thanks in advance,

- Mar= celo.


--20cf300fb1a12ff38204c87f2e93--