nonsequitur / inf-ruby

218 stars 69 forks source link

autoload of minor mode fails #46

Closed lxsameer closed 10 years ago

lxsameer commented 10 years ago

When i try to open a ruby file i get this error:

Debugger entered--Lisp error: (error "Autoloading failed to define function inf-ruby-minor-mode")
  inf-ruby-minor-mode()
  run-hooks(change-major-mode-after-body-hook prog-mode-hook ruby-mode-hook)
  apply(run-hooks (change-major-mode-after-body-hook prog-mode-hook ruby-mode-hook))
  run-mode-hooks(ruby-mode-hook)
  ruby-mode()
  set-auto-mode-0(ruby-mode nil)
  set-auto-mode()
  normal-mode(t)
  after-find-file(nil t)
  find-file-noselect-1(#<buffer air_travel.rb> "~/src/Yellowen/iran_mosafer/app/models/permissions/air_travel.rb" nil nil "~/src/Yellowen/iran_mosafer/app/models/permissions/air_travel.rb" (11544041 2051))
  find-file-noselect("/home/lxsameer/src/Yellowen/iran_mosafer/app/models/permissions/air_travel.rb" nil nil)
  ido-file-internal(raise-frame)
  ido-find-file()
  call-interactively(ido-find-file nil nil)

my configuration is like:

(autoload 'inf-ruby "inf-ruby" "Run an inferior Ruby process" t)
(add-hook 'ruby-mode-hook 'inf-ruby-minor-mode)
(add-hook 'after-init-hook 'inf-ruby-switch-setup)
dgutov commented 10 years ago

What happens if you change the first line to

(autoload 'inf-ruby-minor-mode "inf-ruby" "Run an inferior Ruby process" t)

?

lxsameer commented 10 years ago

same error

dgutov commented 10 years ago

What version of inf-ruby are you using? I suspect you have an older one, somewhere on the load-path.

lxsameer commented 10 years ago

I'm using git version and i installed it couple of times using el-get

lxsameer commented 10 years ago

I fixed that problem. the problem was that about using rbenv mode.

Now I get this error:

Debugger entered--Lisp error: (void-function inf-ruby-console-auto)
  (inf-ruby-console-auto)
  (let ((conf (current-window-configuration))) (inf-ruby-console-auto) (set-window-configuration conf))
  (if (or force (yes-or-no-p "No Ruby console running. Launch automatically?")) (let ((conf (current-window-configuration))) (inf-ruby-console-auto) (set-window-configuration conf)) (error "Aborted"))
  (progn (setq robe-running nil) (if process (progn (delete-process process))) (if (buffer-live-p inf-ruby-buffer) (progn (kill-buffer inf-ruby-buffer))) (if (or force (yes-or-no-p "No Ruby console running. Launch automatically?")) (let ((conf (current-window-configuration))) (inf-ruby-console-auto) (set-window-configuration conf)) (error "Aborted")))
  (if (or force (not process)) (progn (setq robe-running nil) (if process (progn (delete-process process))) (if (buffer-live-p inf-ruby-buffer) (progn (kill-buffer inf-ruby-buffer))) (if (or force (yes-or-no-p "No Ruby console running. Launch automatically?")) (let ((conf (current-window-configuration))) (inf-ruby-console-auto) (set-window-configuration conf)) (error "Aborted"))))
  (let ((process (get-buffer-process inf-ruby-buffer))) (if (or force (not process)) (progn (setq robe-running nil) (if process (progn (delete-process process))) (if (buffer-live-p inf-ruby-buffer) (progn (kill-buffer inf-ruby-buffer))) (if (or force (yes-or-no-p "No Ruby console running. Launch automatically?")) (let ((conf (current-window-configuration))) (inf-ruby-console-auto) (set-window-configuration conf)) (error "Aborted")))))
  robe-start(nil)
  call-interactively(robe-start record nil)
  command-execute(robe-start record)
  execute-extended-command(nil "robe-start")
  smex-read-and-run(("cd" "5x5" "arp" "dbx" "dig" "erc" "ert" "robe-start" "eva" "ftp" "gdb" "ios" "ipy" "irc" "iyp" "jdb" "man" "mpc" "pdb" "pwd" "rsh" "sdb" "xdb" "yow" "calc" "diff" "dirs" "ffap" "gnus" "grep" "help" "ielm" "info" "life" "mail" "mpuz" "ping" "pios" "pong" "smex" "talk" "term" "undo" "yank" "zone" "align" "bs-up" "chmod" "debug" "diary" ...))
  smex()
  call-interactively(smex nil nil)
dgutov commented 10 years ago

the problem was that about using rbenv mode

Do you have any details? If it has a bug, we should probably file it.

(void-function inf-ruby-console-auto)

Oh, that's easy: just add another autoload call, only replace the first argument with inf-ruby-console-auto.

Doesn't el-get compile autoloads? I thought it did.

lxsameer commented 10 years ago

sorry buddy, I was wrong when i try it in another system. I still get first error along side with second one. I'm completely without a clue. here is my config file, maybe you can see the problem:

;;   Kuso IDE
;;    Copyright (C) 2010-2013  Sameer Rahmani <lxsameer@gnu.org>
;;
;;    This program is free software: you can redistribute it and/or modify
;;    it under the terms of the GNU General Public License as published by
;;    the Free Software Foundation, either version 3 of the License, or
;;    any later version.
;;
;;    This program is distributed in the hope that it will be useful,
;;    but WITHOUT ANY WARRANTY; without even the implied warranty of
;;    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;    GNU General Public License for more details.
;;
;;    You should have received a copy of the GNU General Public License
;;    along with this program.  If not, see <http://www.gnu.org/licenses/>.

;; Configuring rbenv
(require 'rbenv)
;(global-rbenv-mode)

(add-hook 'ruby-mode-hook
          'global-rbenv-mode)

;; Ruby mode configurations
(add-to-list 'auto-mode-alist '("\\.rake$" . ruby-mode))
(add-to-list 'auto-mode-alist '("Gemfile$" . ruby-mode))
(add-to-list 'auto-mode-alist '("Rakefile$" . ruby-mode))
(add-to-list 'auto-mode-alist '("gemspec$" . ruby-mode))
(add-to-list 'auto-mode-alist '("config.ru$" . ruby-mode))

;; Yaml mode configurations
(add-to-list 'auto-mode-alist '("\\.yml$" . yaml-mode))
(add-hook 'yaml-mode-hook
      '(lambda ()
         (define-key yaml-mode-map "\C-m" 'newline-and-indent)))

;; Inf Ruby configuration
(autoload 'inf-ruby "inf-ruby" "Run an inferior Ruby process" t)

(add-hook 'inf-ruby-mode-hook 'rbenv-patch)
(add-hook 'after-init-hook 'inf-ruby-switch-setup)

(defun rbenv-patch ()
  (setq irbparams " --inf-ruby-mode -r irb/completion")
  (setq irbpath (rbenv--expand-path "shims" "irb"))
  (setq irb (concat irbpath irbparams))
  (add-to-list 'inf-ruby-implementations (cons "ruby" irb))
  (inf-ruby-minor-mode t)
  )

(global-set-key (kbd "C-c r r") 'inf-ruby)
;; The default indentation system attempts to align the arguments of a function
;; with the opening bracket vertically.
;;
;; While this is subjective, but if you, like me, find this behaviour erratic
;; the following will make emacs indent code inside parenthesis similar to
;;  elsewhere.
(setq ruby-deep-indent-paren nil)

(add-hook 'ruby-mode-hook 'projectile-on)

;; Robe mode
(require 'robe)
(add-hook 'ruby-mode-hook 'robe-mode)
(add-hook 'robe-mode-hook 'robe-ac-setup)

;; Bundler
(require 'bundler)

;; Flymake
(require 'flymake-ruby)
(add-hook 'ruby-mode-hook 'flymake-ruby-load)

;; Rinari configurations
(setq rinari-tags-file-name "TAGS")

;; RHTML configurations
(add-hook 'rhtml-mode-hook
          (lambda () (rinari-launch)))

(add-hook 'ruby-mode-hook (lambda () (autopair-global-mode -1)))
dgutov commented 10 years ago

This doesn't look good:

(add-hook 'inf-ruby-mode-hook 'rbenv-patch)

(defun rbenv-patch ()
  ...
  (inf-ruby-minor-mode t)
  )

inf-ruby-minor-mode is for ruby-mode buffers, and you're enabling it in inf-ruby-mode buffers. It doesn't make sense. It doesn't explain the problems you're having, though: the bindings added by inf-ruby-minor-mode are relatively harmless.

Do M-x find-library RET inf-ruby, see that it opens the right inf-ruby.el, find inf-ruby-minor-mode and inf-ruby-console-auto in it. I don't use el-get and have no intention of learning it, so you'll have to troubleshoot the problem yourself.

If you want less pain I suggest you install the package from MELPA.

lxsameer commented 10 years ago

el-get is not very complex. It is a simple tool. I changed the inf-ruby-mode-hook to ruby-mode-hook but still same error

dgutov commented 10 years ago

It is a simple tool

I can say the same about inf-ruby. From where I'm standing, the problems you're describing should be much easier to debug by yourself. Since there are no similar reports here, I'm guessing the problem is specific to your config.

Simple suggestions:

lxsameer commented 10 years ago

ok thanks buddy

stardiviner commented 10 years ago

@lxsameer I still have this problem, so seems rinari have not updated submodule yet? Is there need to open an issue in Rinari?

lxsameer commented 10 years ago

I gave up on rinari. I'm now use inf-ruby directly