jacott / emacs-pry Goto Github PK
View Code? Open in Web Editor NEWPry support within Emacs
License: GNU General Public License v2.0
Pry support within Emacs
License: GNU General Public License v2.0
When I run M-x: run-pry in emacs24 under win7 with ruby187:
e:/soft/editor/emacs-24.0.93/config/zzcfg.d/pry/ruby/emacs_pry.rb:78: warning: else without rescue is useless
exited abnormally with code 1
So I opened the emacs_pry.rb in emacs ,the flymake found three places with Error or Warning, such as below:
Error_line_37:
37! proc = ->(sym) do
minibuffer info: syntax error, unexpected '>'
Warning_line_78:
78? end
minibuffer info: warning: else without rescue is useless
Error_line_106:
106! end
minibuffer info: syntax error, unexpected KEND, expecting $end
How Can I fix this?
I've tried to test emacs-pry
and when I run run-pry
I've got the following:
/Users/inkel/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/custom_require
.rb:36:in `require': cannot load such file -- termios (LoadError)
from /Users/inkel/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /Users/inkel/.emacs.d/vendor/pry/ruby/emacs_pry.rb:1:in `<top (required)>'
from /Users/inkel/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /Users/inkel/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /Users/inkel/.rvm/gems/ruby-1.9.3-p0@global/gems/pry-0.9.8.1/lib/pry/pry_class.rb:72:in `block in load_requires'
from /Users/inkel/.rvm/gems/ruby-1.9.3-p0@global/gems/pry-0.9.8.1/lib/pry/pry_class.rb:71:in `each'
from /Users/inkel/.rvm/gems/ruby-1.9.3-p0@global/gems/pry-0.9.8.1/lib/pry/pry_class.rb:71:in `load_requires'
from /Users/inkel/.rvm/gems/ruby-1.9.3-p0@global/gems/pry-0.9.8.1/lib/pry/pry_cexited abnormally with code 1
in `<topfrom /Users/inkel/.rvm/gems/ruby-1.9.3-p0@global/bin/pry:19:in `<main>'ry:16:
I know I can fix it running gem install termios
on my command line, though it would be nice to add a requirements section to the README.
I have no idea how easy or hard it is to do, but it would make me happy if it were available there.
The following error can be reproduced by installing "ruby-termios". "termios" on OSX 10.7 fails to get past make.
/Users/dmw/demacs/vendor/emacs-pry/ruby/emacs_pry.rb:42:in block in _emacs_setup': IUCLC bad (RuntimeError) from /Users/dmw/demacs/vendor/emacs-pry/ruby/emacs_pry.rb:72:in
call'
from /Users/dmw/demacs/vendor/emacs-pry/ruby/emacs_pry.rb:72:in block in _emacs_setup' from /Users/dmw/demacs/vendor/emacs-pry/ruby/emacs_pry.rb:69:in
each'
from /Users/dmw/demacs/vendor/emacs-pry/ruby/emacs_pry.rb:69:in _emacs_setup' from /Users/dmw/demacs/vendor/emacs-pry/ruby/emacs_pry.rb:108:in
<top (required)>'
from /Users/dmw/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in requi re' from /Users/dmw/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in
requi
re'
from /Users/dmw/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/gems/1.9.1/gems/pry-0.9.12/lib/pry/pry_class.rb:96:in block in load_requires' from /Users/dmw/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/gems/1.9.1/gems/pry-0.9.12/lib/pry/pry_class.rb:95:in
each'
from /Users/dmw/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/gems/1.9.1/gems/pry-0.9.12/lib/pry/pry_class.rb:95:in load_requires' from /Users/dmw/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/gems/1.9.1/gems/pry-0.9.12/lib/pry/pry_class.rb:118 :in
initial_session_setup'
from /Users/dmw/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/gems/1.9.1/gems/pry-0.9.12/lib/pry/pry_class.rb:143
:in start' from /Users/dmw/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/gems/1.9.1/gems/pry-nav-0.2.3/lib/pry-nav/pry_ext.r b:17:in
start_with_pry_nav'
from /Users/dmw/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/gems/1.9.1/gems/pry-0.9.12/lib/pry/cli.rb:201:in b lock in <top (required)>' from /Users/dmw/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/gems/1.9.1/gems/pry-0.9.12/lib/pry/cli.rb:70:in
ca
ll'
from /Users/dmw/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/gems/1.9.1/gems/pry-0.9.12/lib/pry/cli.rb:70:in bl ock in parse_options' from /Users/dmw/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/gems/1.9.1/gems/pry-0.9.12/lib/pry/cli.rb:70:in
ea
ch'
from /Users/dmw/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/gems/1.9.1/gems/pry-0.9.12/lib/pry/cli.rb:70:in pa rse_options' from /Users/dmw/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/gems/1.9.1/gems/pry-0.9.12/bin/pry:16:in
<top (req
uired)>'
from /Users/dmw/.rvm/gems/ruby-1.9.3-p327/bin/pry:23:in load' from /Users/dmw/.rvm/gems/ruby-1.9.3-p327/bin/pry:23:in
When I run run-pry in emacs 24.2 on emacs24 I get the following error.
from /usr/local/share/gem
s/gems/pry-0.9.10/lib/pry/cli.rb:65:in block in parse_options' from /usr/local/s hare/gems/gems/pry-0.9.10/lib/pry/cli.rb:65:in
each'
from /usr/local/share/gem
s/gems/pry-0.9.10/lib/pry/cli.rb:65:in parse_options' from /usr/local/share/gem s/gems/pry-0.9.10/bin/pry:16:in
<top (required)>'
from /usr/local/bin/pry:2
3:in load' from /usr/local/bin/pry:23:in
$ ruby -v
ruby 1.9.3p327 (2012-11-10 revision 37606) [x86_64-linux]
Anyway, When use IRB or Pry in Terminal, it all support this.
Similar, Term-mode can load too.
So, I think Pry can support this ?
When I run M-x run-pry
I receive the following error:
Searching for program: no such file or directory, pry
But pry is definitely installed:
$ which pry
/home/duncan/.rbenv/shims/pry
Perhaps it's being confused by rbenv?
ruby -v ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-linux]
rvm -v rvm 1.18.21 (master) by Wayne E. Seguin [email protected], Michal Papis [email protected] [https://rvm.io/]
pry -v Pry version 0.9.12 on Ruby 2.0.0
gem -v 2.0.3
emacs gnu 24
After install emacs-pry and run run-pry I Got the following error
/ruby-2.0.0-po/bin/ruby_noexec_wrapper:14:in `
'exited abnormally with code 1. Any suggestion.Thanks
When I run run-pry
a window opens for a second then closes. Even when I have debug-on-error
enabled, I can't find any errors. I am in a ruby file when I try running it. Are there further instructions I am missing?
I may have overlooked this some place, but I'm wondering if there is a way for emacs-pry to act as a console for a Rails application.
For some reason while running pry-intercept
I get this error:
Debugger entered--Lisp error: (wrong-type-argument stringp nil)
string-match(" -- \\([^ ]+\\.rb\\)" nil)
(or (string-match " -- \\([^ ]+\\.rb\\)" command) (string-match " \\([^- ][^ ]*\\.rb\\)" command))
(and (or (string-match " -- \\([^ ]+\\.rb\\)" command) (string-match " \\([^- ][^ ]*\\.rb\\)" command)) (match-beginning 1))
(let* ((proc-buffer (get-buffer "*pry*")) (proc (get-buffer-process proc-buffer)) (process-environment process-environment) (main-prog-start (and (or (string-match " -- \\([^ ]+\\.rb\\)" command) (string-match " \\([^- ][^ ]*\\.rb\\)" command)) (match-beginning 1))) (pid (number-to-string (emacs-pid))) (fn (concat "/tmp/emacs_pry_" pid ".rb")) source) (unless (eq break-type (quote rerun)) (if (and (> (length buffer-file-name) 3) (string= (substring (buffer-file-name) -3) ".rb")) (if pry-target-mark (move-marker pry-target-mark (line-beginning-position) (current-buffer)) (setq pry-target-mark (copy-marker (line-beginning-position)))) (error "pry-intercept can only be run on ruby buffers"))) (with-current-buffer (marker-buffer pry-target-mark) (unless (eq break-type (quote nonstop)) (setq source (concat (buffer-substring 1 (marker-position pry-target-mark)) "binding.pry;" (buffer-substring (marker-position pry-target-mark) (1+ (buffer-size))))) (write-region source nil fn) (unless main-prog-start (error "Can't find ruby program name: %s" command)) (setenv "_EMACS_MONKEY_PATCH" (concat pid ":" (buffer-file-name)))) (setq command (concat (substring command 0 main-prog-start) (pry-source-dir) "ruby/emacs_pry.rb " (substring command main-prog-start)))) (when (and proc (equal (process-status proc) (quote run))) (set-process-sentinel proc nil) (kill-process proc) (accept-process-output proc 0.5)) (when proc-buffer (with-current-buffer proc-buffer (setq buffer-undo-list t) (erase-buffer) (setq buffer-undo-list nil))) (run-pry command))
(let ((command (if (and arg (not (stringp arg))) (read-string "Run Pry: " (if (and pry-intercept-command (eq 0 arg)) pry-intercept-command (concat "ruby -I. " (buffer-file-name)))) (if (stringp arg) arg)))) (if command (setq pry-intercept-command command) (setq command pry-intercept-command)) (let* ((proc-buffer (get-buffer "*pry*")) (proc (get-buffer-process proc-buffer)) (process-environment process-environment) (main-prog-start (and (or (string-match " -- \\([^ ]+\\.rb\\)" command) (string-match " \\([^- ][^ ]*\\.rb\\)" command)) (match-beginning 1))) (pid (number-to-string (emacs-pid))) (fn (concat "/tmp/emacs_pry_" pid ".rb")) source) (unless (eq break-type (quote rerun)) (if (and (> (length buffer-file-name) 3) (string= (substring (buffer-file-name) -3) ".rb")) (if pry-target-mark (move-marker pry-target-mark (line-beginning-position) (current-buffer)) (setq pry-target-mark (copy-marker (line-beginning-position)))) (error "pry-intercept can only be run on ruby buffers"))) (with-current-buffer (marker-buffer pry-target-mark) (unless (eq break-type (quote nonstop)) (setq source (concat (buffer-substring 1 (marker-position pry-target-mark)) "binding.pry;" (buffer-substring (marker-position pry-target-mark) (1+ ...)))) (write-region source nil fn) (unless main-prog-start (error "Can't find ruby program name: %s" command)) (setenv "_EMACS_MONKEY_PATCH" (concat pid ":" (buffer-file-name)))) (setq command (concat (substring command 0 main-prog-start) (pry-source-dir) "ruby/emacs_pry.rb " (substring command main-prog-start)))) (when (and proc (equal (process-status proc) (quote run))) (set-process-sentinel proc nil) (kill-process proc) (accept-process-output proc 0.5)) (when proc-buffer (with-current-buffer proc-buffer (setq buffer-undo-list t) (erase-buffer) (setq buffer-undo-list nil))) (run-pry command)))
pry-intercept(nil)
call-interactively(pry-intercept t nil)
execute-extended-command(nil)
call-interactively(execute-extended-command nil nil)
recursive-edit()
debug(error (wrong-type-argument stringp nil))
string-match(" -- \\([^ ]+\\.rb\\)" nil)
(or (string-match " -- \\([^ ]+\\.rb\\)" command) (string-match " \\([^- ][^ ]*\\.rb\\)" command))
(and (or (string-match " -- \\([^ ]+\\.rb\\)" command) (string-match " \\([^- ][^ ]*\\.rb\\)" command)) (match-beginning 1))
(let* ((proc-buffer (get-buffer "*pry*")) (proc (get-buffer-process proc-buffer)) (process-environment process-environment) (main-prog-start (and (or (string-match " -- \\([^ ]+\\.rb\\)" command) (string-match " \\([^- ][^ ]*\\.rb\\)" command)) (match-beginning 1))) (pid (number-to-string (emacs-pid))) (fn (concat "/tmp/emacs_pry_" pid ".rb")) source) (unless (eq break-type (quote rerun)) (if (and (> (length buffer-file-name) 3) (string= (substring (buffer-file-name) -3) ".rb")) (if pry-target-mark (move-marker pry-target-mark (line-beginning-position) (current-buffer)) (setq pry-target-mark (copy-marker (line-beginning-position)))) (error "pry-intercept can only be run on ruby buffers"))) (with-current-buffer (marker-buffer pry-target-mark) (unless (eq break-type (quote nonstop)) (setq source (concat (buffer-substring 1 (marker-position pry-target-mark)) "binding.pry;" (buffer-substring (marker-position pry-target-mark) (1+ (buffer-size))))) (write-region source nil fn) (unless main-prog-start (error "Can't find ruby program name: %s" command)) (setenv "_EMACS_MONKEY_PATCH" (concat pid ":" (buffer-file-name)))) (setq command (concat (substring command 0 main-prog-start) (pry-source-dir) "ruby/emacs_pry.rb " (substring command main-prog-start)))) (when (and proc (equal (process-status proc) (quote run))) (set-process-sentinel proc nil) (kill-process proc) (accept-process-output proc 0.5)) (when proc-buffer (with-current-buffer proc-buffer (setq buffer-undo-list t) (erase-buffer) (setq buffer-undo-list nil))) (run-pry command))
(let ((command (if (and arg (not (stringp arg))) (read-string "Run Pry: " (if (and pry-intercept-command (eq 0 arg)) pry-intercept-command (concat "ruby -I. " (buffer-file-name)))) (if (stringp arg) arg)))) (if command (setq pry-intercept-command command) (setq command pry-intercept-command)) (let* ((proc-buffer (get-buffer "*pry*")) (proc (get-buffer-process proc-buffer)) (process-environment process-environment) (main-prog-start (and (or (string-match " -- \\([^ ]+\\.rb\\)" command) (string-match " \\([^- ][^ ]*\\.rb\\)" command)) (match-beginning 1))) (pid (number-to-string (emacs-pid))) (fn (concat "/tmp/emacs_pry_" pid ".rb")) source) (unless (eq break-type (quote rerun)) (if (and (> (length buffer-file-name) 3) (string= (substring (buffer-file-name) -3) ".rb")) (if pry-target-mark (move-marker pry-target-mark (line-beginning-position) (current-buffer)) (setq pry-target-mark (copy-marker (line-beginning-position)))) (error "pry-intercept can only be run on ruby buffers"))) (with-current-buffer (marker-buffer pry-target-mark) (unless (eq break-type (quote nonstop)) (setq source (concat (buffer-substring 1 (marker-position pry-target-mark)) "binding.pry;" (buffer-substring (marker-position pry-target-mark) (1+ ...)))) (write-region source nil fn) (unless main-prog-start (error "Can't find ruby program name: %s" command)) (setenv "_EMACS_MONKEY_PATCH" (concat pid ":" (buffer-file-name)))) (setq command (concat (substring command 0 main-prog-start) (pry-source-dir) "ruby/emacs_pry.rb " (substring command main-prog-start)))) (when (and proc (equal (process-status proc) (quote run))) (set-process-sentinel proc nil) (kill-process proc) (accept-process-output proc 0.5)) (when proc-buffer (with-current-buffer proc-buffer (setq buffer-undo-list t) (erase-buffer) (setq buffer-undo-list nil))) (run-pry command)))
pry-intercept(nil)
call-interactively(pry-intercept t nil)
execute-extended-command(nil)
call-interactively(execute-extended-command nil nil)
recursive-edit()
debug(error (wrong-type-argument stringp nil))
string-match(" -- \\([^ ]+\\.rb\\)" nil)
(or (string-match " -- \\([^ ]+\\.rb\\)" command) (string-match " \\([^- ][^ ]*\\.rb\\)" command))
(and (or (string-match " -- \\([^ ]+\\.rb\\)" command) (string-match " \\([^- ][^ ]*\\.rb\\)" command)) (match-beginning 1))
(let* ((proc-buffer (get-buffer "*pry*")) (proc (get-buffer-process proc-buffer)) (process-environment process-environment) (main-prog-start (and (or (string-match " -- \\([^ ]+\\.rb\\)" command) (string-match " \\([^- ][^ ]*\\.rb\\)" command)) (match-beginning 1))) (pid (number-to-string (emacs-pid))) (fn (concat "/tmp/emacs_pry_" pid ".rb")) source) (unless (eq break-type (quote rerun)) (if (and (> (length buffer-file-name) 3) (string= (substring (buffer-file-name) -3) ".rb")) (if pry-target-mark (move-marker pry-target-mark (line-beginning-position) (current-buffer)) (setq pry-target-mark (copy-marker (line-beginning-position)))) (error "pry-intercept can only be run on ruby buffers"))) (with-current-buffer (marker-buffer pry-target-mark) (unless (eq break-type (quote nonstop)) (setq source (concat (buffer-substring 1 (marker-position pry-target-mark)) "binding.pry;" (buffer-substring (marker-position pry-target-mark) (1+ (buffer-size))))) (write-region source nil fn) (unless main-prog-start (error "Can't find ruby program name: %s" command)) (setenv "_EMACS_MONKEY_PATCH" (concat pid ":" (buffer-file-name)))) (setq command (concat (substring command 0 main-prog-start) (pry-source-dir) "ruby/emacs_pry.rb " (substring command main-prog-start)))) (when (and proc (equal (process-status proc) (quote run))) (set-process-sentinel proc nil) (kill-process proc) (accept-process-output proc 0.5)) (when proc-buffer (with-current-buffer proc-buffer (setq buffer-undo-list t) (erase-buffer) (setq buffer-undo-list nil))) (run-pry command))
(let ((command (if (and arg (not (stringp arg))) (read-string "Run Pry: " (if (and pry-intercept-command (eq 0 arg)) pry-intercept-command (concat "ruby -I. " (buffer-file-name)))) (if (stringp arg) arg)))) (if command (setq pry-intercept-command command) (setq command pry-intercept-command)) (let* ((proc-buffer (get-buffer "*pry*")) (proc (get-buffer-process proc-buffer)) (process-environment process-environment) (main-prog-start (and (or (string-match " -- \\([^ ]+\\.rb\\)" command) (string-match " \\([^- ][^ ]*\\.rb\\)" command)) (match-beginning 1))) (pid (number-to-string (emacs-pid))) (fn (concat "/tmp/emacs_pry_" pid ".rb")) source) (unless (eq break-type (quote rerun)) (if (and (> (length buffer-file-name) 3) (string= (substring (buffer-file-name) -3) ".rb")) (if pry-target-mark (move-marker pry-target-mark (line-beginning-position) (current-buffer)) (setq pry-target-mark (copy-marker (line-beginning-position)))) (error "pry-intercept can only be run on ruby buffers"))) (with-current-buffer (marker-buffer pry-target-mark) (unless (eq break-type (quote nonstop)) (setq source (concat (buffer-substring 1 (marker-position pry-target-mark)) "binding.pry;" (buffer-substring (marker-position pry-target-mark) (1+ ...)))) (write-region source nil fn) (unless main-prog-start (error "Can't find ruby program name: %s" command)) (setenv "_EMACS_MONKEY_PATCH" (concat pid ":" (buffer-file-name)))) (setq command (concat (substring command 0 main-prog-start) (pry-source-dir) "ruby/emacs_pry.rb " (substring command main-prog-start)))) (when (and proc (equal (process-status proc) (quote run))) (set-process-sentinel proc nil) (kill-process proc) (accept-process-output proc 0.5)) (when proc-buffer (with-current-buffer proc-buffer (setq buffer-undo-list t) (erase-buffer) (setq buffer-undo-list nil))) (run-pry command)))
pry-intercept(nil)
call-interactively(pry-intercept t nil)
execute-extended-command(nil)
call-interactively(execute-extended-command nil nil)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.