From: Marcelo de Moraes Serpa <celoserpa@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Encoding error when calling a ruby script from Emacs using shell-command
Date: Thu, 30 Aug 2012 12:41:08 -0500 [thread overview]
Message-ID: <CACHMzOHr6QioGroiBe1wn658OsHmm7h_w46jHFPXTi0-zYrb6w@mail.gmail.com> (raw)
In-Reply-To: <CACHMzOGwzxVVOT3Krr=QijuYKfJqcGKefsdtywn2Pd919Drs5Q@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1731 bytes --]
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.
>
>
[-- Attachment #2: Type: text/html, Size: 2668 bytes --]
next prev parent reply other threads:[~2012-08-30 17:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-30 17:40 Encoding error when calling a ruby script from Emacs using shell-command Marcelo de Moraes Serpa
2012-08-30 17:41 ` Marcelo de Moraes Serpa [this message]
2012-08-30 21:16 ` Peter Dyballa
2012-08-30 23:01 ` Marcelo de Moraes Serpa
2012-08-31 22:18 ` Marcelo de Moraes Serpa
2012-08-31 22:40 ` Peter Dyballa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CACHMzOHr6QioGroiBe1wn658OsHmm7h_w46jHFPXTi0-zYrb6w@mail.gmail.com \
--to=celoserpa@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.