emacsorphanage / req-package

dependency management system on top of use-package
GNU General Public License v3.0
153 stars 14 forks source link

`:loader :path` packages keep trying to get installed #40

Closed ivan-m closed 7 years ago

ivan-m commented 7 years ago

I have a few files that I've picked up along the way that aren't available via package.el. Previously I had just either autoloaded or require'd them.

I'm now trying to load them up using req-package but it doesn't seem to work; for example if I have this in my config:

(req-package hs-lint
  :loader :path
  :commands hs-lint)

But when I try and launch Emacs I get the following backtrace:

Debugger entered--Lisp error: (error "Package ‘hs-lint-’ is unavailable")
  signal(error ("Package ‘hs-lint-’ is unavailable"))
  error("Package `%s-%s' is unavailable" hs-lint "")
  package-compute-transaction(nil ((hs-lint)))
  package-install(hs-lint)
  use-package-ensure-elpa(hs-lint t)
  use-package-ensure-elpa(hs-lint)
  (progn (quote "/Users/ivan/.emacs.d/site-lisp/hs-lint.el") (use-package-ensure-elpa (quote hs-lint)) (if (fboundp (quote hs-lint)) nil (autoload (function hs-lint) "hs-lint" nil t)) (condition-case err (progn) ((debug error) (ignore (display-warning (quote use-package) (format "%s %s: %s" "hs-lint" ":init" (error-message-string err)) :error)))) (eval-after-load (quote hs-lint) (function (lambda nil (progn (condition-case err (progn (req-package-handle-loading ... ...) (req-package-loaded ...)) ((debug error) (ignore ...))) t)))))
  eval((progn (quote "/Users/ivan/.emacs.d/site-lisp/hs-lint.el") (use-package-ensure-elpa (quote hs-lint)) (if (fboundp (quote hs-lint)) nil (autoload (function hs-lint) "hs-lint" nil t)) (condition-case err (progn) ((debug error) (ignore (display-warning (quote use-package) (format "%s %s: %s" "hs-lint" ":init" (error-message-string err)) :error)))) (eval-after-load (quote hs-lint) (function (lambda nil (progn (condition-case err (progn (req-package-handle-loading ... ...) (req-package-loaded ...)) ((debug error) (ignore ...))) t))))))
  req-package-eval-form((use-package hs-lint :init (progn) :config (progn (req-package-handle-loading (quote (hs-lint nil)) (lambda nil (progn))) (req-package-loaded (quote (hs-lint nil)))) :preface (message "Load Path: %s" load-path) (req-package-providers-present-path (quote hs-lint)) :commands hs-lint))
  #[nil "\301!\207" [EVAL req-package-eval-form] 2]()
  req-package-handle-loading((hs-lint nil) #[nil "\301!\207" [EVAL req-package-eval-form] 2])
  req-package-eval((hs-lint nil))
  #[(key value) "\302  \303#\303\232\205\304\305    #\210\306!\207" [key req-package-deps-left gethash 0 puthash -1 req-package-eval] 4]((hs-lint nil) 0)
  maphash(#[(key value) "\302  \303#\303\232\205\304\305    #\210\306!\207" [key req-package-deps-left gethash 0 puthash -1 req-package-eval] 4] #s(hash-table size 200 test equal rehash-size 1.5 rehash-threshold 0.8 data ((exec-path-from-shell nil) -1 (diminish nil) -1 (bind-key nil) -1 (alect-themes nil) -1 (tramp nil) -1 (recentf nil) -1 (notifications nil) -1 (lorem-ipsum nil) -1 (rainbow-delimiters nil) -1 (whitespace nil) -1 (flycheck nil) -1 (flycheck-color-mode-line nil) -1 (flyspell nil) -1 (auto-highlight-symbol nil) -1 (subword nil) -1 (mmm-mode nil) -1 (company nil) -1 (goto-chg nil) -1 (paredit nil) -1 (paredit-menu (paredit)) -1 (hydra nil) -1 (org nil) -1 (csv-mode (org)) 1 (ispell nil) -1 (rw-hunspell (ispell rw-language-and-country-codes rw-ispell)) 2 (font-utils nil) -1 (unicode-fonts (font-utils)) -1 (ascii-art-to-unicode nil) -1 (paren nil) -1 (saveplace nil) -1 (sql nil) -1 (image-file nil) -1 (delsel nil) -1 (unkillable-scratch nil) -1 (man nil) -1 (woman (faces)) 1 (compile nil) -1 (bury-successful-compilation nil) -1 (ediff nil) -1 (darcsum nil) -1 (helm nil) -1 (graphviz-dot-mode nil) -1 (nix-mode nil) -1 (nixos-options nil) -1 (yaml-mode nil) -1 (zoom-frm nil) -1 (auctex nil) -1 (auctex (reftex)) 1 (latex (auctex flyspell)) 1 (auctex (org)) 1 ...)))
  req-package-finish()
  eval-buffer(#<buffer  *load*> nil "/Users/ivan/.emacs.d/init.el" nil t)  ; Reading at buffer position 2046
  load-with-code-conversion("/Users/ivan/.emacs.d/init.el" "/Users/ivan/.emacs.d/init.el" t t)
  load("/Users/ivan/.emacs.d/init" t t)
  #[0 "\205\266   \306=\203\307\310Q\202? \311=\204\307\312Q\202?\313\307\314\315#\203*\316\202?\313\307\314\317#\203>\320\321\322!D\nB\323\202?\316\324\325\324\211#\210\324=\203e\326\327\330\307\331Q!\"\325\324\211#\210\324=\203d\210\203\247\332!\333\232\203\247\334!\211\335P\336!\203\201\211\202\214\336!\203\213\202\214\314\262\203\245\337\"\203\243\340\341#\210\342\343!\210\266\f?\205\264\314\325\344\324\211#)\262\207" [init-file-user system-type delayed-warnings-list user-init-file inhibit-default-init inhibit-startup-screen ms-dos "~" "/_emacs" windows-nt "/.emacs" directory-files nil "^\\.emacs\\(\\.elc?\\)?$" "~/.emacs" "^_emacs\\(\\.elc?\\)?$" initialization format-message "`_emacs' init file is deprecated, please use `.emacs'" "~/_emacs" t load expand-file-name "init" file-name-as-directory "/.emacs.d" file-name-extension "elc" file-name-sans-extension ".el" file-exists-p file-newer-than-file-p message "Warning: %s is newer than %s" sit-for 1 "default"] 7]()
  command-line()
  normal-top-level()
ivan-m commented 7 years ago

I tried to add in :pin manual, which didn't seem to affect it.

ivan-m commented 7 years ago

Related: https://github.com/jwiegley/use-package/issues/320

Should req-package set :ensure nil when :loader :path is used?

ivan-m commented 7 years ago

Also https://github.com/jwiegley/use-package/issues/190 (and I do have (setq use-package-always-ensure t)).

edvorg commented 7 years ago

Hi. Regarding always-ensure this should not be used with req-package. req-package has a providers system, which is more feature rich than the one we have in use-package.

edvorg commented 7 years ago

Investigating your load path related issue.

edvorg commented 7 years ago

Ok. So, I believe this is how you should use :path loader 2017-03-15-132540_1275x1599_scrot

(req-package test-foo
  :loader :path
  :load-path "/home/edvorg/Documents"
  :config (message "test %s" test-foo-value))
ivan-m commented 7 years ago

Oh, it can't pick it up from the existing load-path? I might stick with autoloads for them then.

edvorg commented 7 years ago

I think this might be a good way for further improvement ;)

edvorg commented 7 years ago

Actually I'm looking at this function now @ivan-m . And I think the we support what you want, but there is possibly some bug there

(defun req-package--load-path (package)
  (append (ht-get req-package-paths package nil) load-path))

Here we merge the system load-path with the provided one. Need to check, why it doesn't work for you.

edvorg commented 7 years ago

Yes, it actually works @ivan-m . You don't even have to specify :loader :path, because req-package will walk through all the providers and check if any one has your package. just make sure that you put provide call in your path located files and setup your load-path before requiring any packages. 2017-03-15-141843_1274x1599_scrot Could you please confirm if it works for you now?

edvorg commented 7 years ago

The bar.el file contents from example above

(defconst bar-var 9)

(provide 'bar)
ivan-m commented 7 years ago

That seems to do it, thanks!