arnested / drupal-mode

Advanced Emacs minor mode for Drupal development
https://melpa.org/#/drupal-mode
GNU General Public License v3.0
32 stars 14 forks source link

Cannot open load file: no such file or directory, gtags #67

Closed bmag closed 8 years ago

bmag commented 9 years ago

Reproduction recipe: With Emacs 24.5, the following ~/.emacs.d/init.el file and no other files in ~/.emacs.d directory:

;;; ~/.emacs.d/init.el
(require 'package)
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/"))
(package-initialize)

Result: An error with this backtrace:

Debugger entered--Lisp error: (file-error "Cannot open load file" "no such file or directory" "gtags")
  require(gtags)
  eval-buffer(#<buffer  *load*> nil "/home/bar/.emacs.d/elpa/drupal-mode-20150830.1227/drupal/gtags.el" nil t)  ; Reading at buffer position 916
  load-with-code-conversion("/home/bar/.emacs.d/elpa/drupal-mode-20150830.1227/drupal/gtags.el" "/home/bar/.emacs.d/elpa/drupal-mode-20150830.1227/drupal/gtags.el" nil t)
  require(drupal/gtags)
  #[nil "\300\301!\207" [require drupal/gtags] 2]()
  eval-after-load(helm-gtags #[nil "\300\301!\207" [require drupal/gtags] 2])
  byte-code("\306  \n\f%\307\211.\2031

I also get the error "Cannot open load file: no such file or directory, gtags" (without the backtrace) when opening a directory with Dired (e.g. via C-x d).

kostajh commented 9 years ago

Try a M-: (require 'gtags).

I have a use-package statement in my configuration:

  (use-package gtags
    :ensure t
    :defer t)
bmag commented 9 years ago

@kostajh your suggestion didn't work, but it did help. Turns out gtags package is only available from Marmalade, but I didn't have Marmalade in package-archives. However, I checked and installing drupal-mode and helm-gtags doesn't automatically install gtags. To summarize: drupal-mode assumes that if drupal-mode and helm-gtags are installed, then gtags is also installed and tries to require it. However, the assumption is wrong and causes the error above.

arnested commented 9 years ago

Yeah. The assumption about gtags being available is wrong.

I tried to solve this - see the feature/helm-gtags branch. I haven't put much effort into it so it might be a bit naïve and/or rough around the edges.

If someone could have a look and provide feedback I'll be grateful.

The only change is the addtion of a dedicated drupal/helm-gtags.el instead of relying on drupal/gtags.el.

jmjoy commented 8 years ago

I also meet this problem on Windows. Because the emacs on Windows lose gtags.el, so you can just copy the gtags.el to a load-path. This gtags.el is from GNU Global source. gtags.zip

arnested commented 8 years ago

I just made a few adaptions to the feature/helm-gtags branch and merged it to develop.

@bmag, let me know if this works or breaks something for you.

@jmjoy, I'm not sure this is related to what you experience. Your problem seems related to the standard gtags -- and that should not break anything if it is not installed. Feel free to open a new issue with more details and we'll see if we can figure out what's happening for you.