help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: req-package


From: Edward Knyshov
Subject: Re: req-package
Date: Thu, 13 Aug 2015 14:06:06 +0000

Basically yes. Also it provides you simplier api, because you do not pushed
to write config in reversed way. You write what depends on what, instead of
what is dependency of what. You can write much more modularised config in
req-package way, because each package is configured with its own
req-package form. Imaging how cumbersome your config will be with
eval-after-load, if 10 package are dependent on clojure-mode and some of
them dependent on helm and some of them on flycheck and so on. I'm not even
sure that it will be easy to support.

Yes, sure, it will fail, because not all dependencies are satisfied. Why
use cider without clojure-mode for example or why to try enable eldoc in
clojure-mode if clojure mode failes to install?

On Thu, Aug 13, 2015 at 4:44 PM Alexander Shukaev <haroogan@gmail.com>
wrote:

> > Yes, sure. Sorry for late answer. Here is example. I configure clojure
> > development environment with req-package(use-package)
> >
> > (req-package eldoc
> > ;; this form call will download eldoc package from elpa or el-get as
> > needed
> >
> >   :commands eldoc
> >
> >
> > -mode
> > ;; this parameter delays loading of eldoc until eldo-mode function is
> > called
> >
> >   :init (prog
> >
> > n (add-h
> >
> > ook 'emacs-lisp-mode-hook (lambda () (eldoc-mode 1)))
> > ;; add eldoc to emacs lisp mode
> >
> >
> >   (add-hook 'lisp-interaction-mode-hook (lambda () (eldoc-mode 1)))))
> >
> > ;; add eldoc to
> > lisp based interaction modes
> >  modes
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > (req-package clojure-mode
> >
> >  ;; this form call will download
> > clojure-mode
> >  package from elpa or el-get as needed
> >   :mode (("clj\\'" . clojure-mo
> >
> > de)
> > ;; this parameter delays loading of clojure-mode until
> >
> >
> > ("cljs\\'" . clojure-mode)))
> > ;; file with any of these extensions is loaded
> >
> >
> > (req-package cider
> >
> >  ;; this form call will download
> > cider
> >  package from elpa or el-get as needed
> >   :require (clojure-m
> >
> > ode eldoc)
> > ;; this parameters makes sure that this req-package form is evaluated
> > after all of these packages are loaded
> >
> >   :commands cider-mode
> > ;; delay loading until cider-mode function is called
> >
> >   :init (progn (add-hook 'clojure-mode-h
> >
> > ook #'cider-mode)
> > ;; start cider in clojure mode
> >
> >
> >
> > (add-hook 'cider-mode-hook #'eldoc-mode)
> > ;; start eldoc after cider setups some of its internal things and calls
> > its hook
> >
> >
> >
> > (setq nrepl-log-messages t)))
> > ;; some logging stuff
> >
> >
> > (req-package-finish) ;; start loading
> >
> >
> > This
> > example may bit a bit hard to understand in concrete, but you may get an
> > idea.
>
> Hello Edward,
>
> so, basically all that dance is to simply avoid writing
>
> (with-eval-after-load 'closure-mode
>   (add-hook 'clojure-mode-hook #'cider-mode))
>
> (with-eval-after-load 'eldoc
>   (add-hook 'cider-mode-hook #'eldoc-mode))
>
> (while still using `use-package')?  Besides, if I understand it
> correctly, if `closure-mode', for example, would not be there (and not
> downloaded from archives), then the whole configuration will fail?
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]