From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo de Moraes Serpa Subject: [OT] Encoding error when calling a ruby script from Emacs using shell-command Date: Thu, 30 Aug 2012 22:42:14 -0500 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=14dae9340cebef236a04c887931e Return-path: Received: from eggs.gnu.org ([208.118.235.92]:49299) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T7I7d-00055y-44 for emacs-orgmode@gnu.org; Thu, 30 Aug 2012 23:42:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T7I7b-00068Z-Pi for emacs-orgmode@gnu.org; Thu, 30 Aug 2012 23:42:17 -0400 Received: from mail-iy0-f169.google.com ([209.85.210.169]:50305) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T7I7b-00068V-IE for emacs-orgmode@gnu.org; Thu, 30 Aug 2012 23:42:15 -0400 Received: by iagk10 with SMTP id k10so4965994iag.0 for ; Thu, 30 Aug 2012 20:42:15 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Org Mode --14dae9340cebef236a04c887931e Content-Type: text/plain; charset=ISO-8859-1 Hey list, I've tried posting on help-gnu-emacs mailing list first, but not luck so far, so I thought I'd try here, as I know there are many savvy emacs users around. 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 'utf-8-unix)) > (shell-command "/Users/myself/.rvm/bin/rvm ruby-1.9.3-p194 do > /usr/bin/myrubyscript") > )) > (add-hook 'after-save-hook 'test) NOTE: The (let ((universal-coding-system-argument 'utf-8-unix)) was an attempt to fix it, but it made no difference whatsoever. 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. --14dae9340cebef236a04c887931e Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Hey list,

I've tried posting on help-gnu-emacs mail= ing list first, but not luck so far, so I thought I'd try here, as I kn= ow there are many savvy emacs users around.

I have a small Ruby CLI program that I want t= o call from emacs.=A0This script simply opens an emacs orgmode file from a = specific location in my hard drive, and does some text processing.=A0When I= call it from the terminal directly, it works fine. When I call it from ema= cs, 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-argum= ent 'utf-8-unix))
=A0 =A0 =A0 =A0 (shell-command =A0"/Users/myself/.rvm/bin/rvm ruby-1.9= .3-p194 do /usr/bin/myrubyscript")
=A0 =A0 ))
(add-hook 'aft= er-save-hook 'test)


NOTE: The (let = ((universal-coding-system-argument 'utf-8-unix)) was an attempt to fix = it, but it made no difference whatsoever.

After I save a buffer, th= e shell-command function is fired, but I get the following output in the &q= uot;*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/pa= rser.rb:89:in `split'
/Users/myself/.rvm/gems/ruby-1.9.3-p194/gems/o= rg-ruby-0.6.3/lib/org-ruby/parser.rb:89:in `initia

The strange thing is that the file that this script opens *is* a= ccessible, 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 h= ere, I'd be really grateful!

Thanks in advance,

- Marcelo.
--14dae9340cebef236a04c887931e--