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: Encoding error when calling a ruby script from Emacs using shell-command Date: Thu, 30 Aug 2012 12:40:01 -0500 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=485b397dd5bd32e7cb04c87f2a54 X-Trace: ger.gmane.org 1346354807 15411 80.91.229.3 (30 Aug 2012 19:26:47 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 30 Aug 2012 19:26:47 +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:49 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 1T7AO8-0005Zu-RB for geh-help-gnu-emacs@m.gmane.org; Thu, 30 Aug 2012 21:26:49 +0200 Original-Received: from localhost ([::1]:40528 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T7AO6-0003fL-5q for geh-help-gnu-emacs@m.gmane.org; Thu, 30 Aug 2012 15:26:46 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:58020) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T78ix-00022S-9O for help-gnu-emacs@gnu.org; Thu, 30 Aug 2012 13:40:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T78is-0006xu-4t for help-gnu-emacs@gnu.org; Thu, 30 Aug 2012 13:40:11 -0400 Original-Received: from mail-qa0-f48.google.com ([209.85.216.48]:51287) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T78ir-0006mM-VU for help-gnu-emacs@gnu.org; Thu, 30 Aug 2012 13:40:06 -0400 Original-Received: by qady1 with SMTP id y1so452737qad.0 for ; Thu, 30 Aug 2012 10:40:01 -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=tCIazuWLz433ghwC7HTy6MO/tPwMV55Zkjbxja934Hw=; b=AxFI8FMMC6zJsdNfNDR0Qt8B+iaNLgoK1YZ4OU2w00zbqOkWXK1a34OEwJzyNBdMes e0JvS6mSL7suKlYekjsaof6ps4pF/YxvcVaVTaH0Pc8wMC4bOZWggVyNiirdL37Dctav NIgT62KTRvl//6c46/gmgTQieIHSMAAvtn1/p/ow4Nm2xuvgu1SfrSh9cLOqflUrdOgN LKEnnWvXsIWgMBo9o/2ooWdd3xmMQhd7O6hHzuDGN7pcN5Yf6Jr0TZiFusNYK4r2SaxY 70GkdrfPgh9JR8oP77SCTm04klv7Tcb7Y7qCOgI7frI6wOE+WkUjQKlSFkWMZkXzPBIk TOXA== Original-Received: by 10.224.186.203 with SMTP id ct11mr12615887qab.80.1346348401223; Thu, 30 Aug 2012 10:40:01 -0700 (PDT) Original-Received: by 10.49.37.196 with HTTP; Thu, 30 Aug 2012 10:40:01 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.216.48 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:86594 Archived-At: --485b397dd5bd32e7cb04c87f2a54 Content-Type: text/plain; charset=ISO-8859-1 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. --485b397dd5bd32e7cb04c87f2a54 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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.

--485b397dd5bd32e7cb04c87f2a54--