unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* .emacs not loading libraries
@ 2015-10-17 12:58 Mart van de Wege
  2015-10-17 15:34 ` Emanuel Berg
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Mart van de Wege @ 2015-10-17 12:58 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

I've installed a bunch of libraries from elpa, and I found at least one
of them is not available unless I do an explicit M-x load-library

Now, I thought to add that to my .emacs, but neither (load-library
"org-alert") nor (require 'org-alert) works. What am I doing wrong?

.emacs.d/elpa/ is in my load-path.

Regards,

Mart

-- 
"We will need a longer wall when the revolution comes."
    --- AJS, quoting an uncertain source.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: .emacs not loading libraries
  2015-10-17 12:58 .emacs not loading libraries Mart van de Wege
@ 2015-10-17 15:34 ` Emanuel Berg
  2015-10-17 15:38 ` Teemu Likonen
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 12+ messages in thread
From: Emanuel Berg @ 2015-10-17 15:34 UTC (permalink / raw)
  To: help-gnu-emacs

Mart van de Wege <mvdwege@gmail.com> writes:

> I've installed a bunch of libraries from elpa, and
> I found at least one of them is not available unless
> I do an explicit M-x load-library
>
> Now, I thought to add that to my .emacs, but neither
> (load-library "org-alert")

... you mean that interactive `load-library' works but
not as Lisp? If you check out the source for
load-library, the only thing it is is an interactive
interface to `load'. So probably it helps you with the
path when called with M-x. Without it, try using the
whole path. Or why not ditch it altogether in favor of
load? That should eliminate the interactive/Lisp
discrepancy, if any. load searches `load-path' and
appends .elc (first), then .el.

> (require 'org-alert)

If what you `require' isn't provided require is also
an interface to load. So use load to troubleshot this.

> .emacs.d/elpa/ is in my load-path.

Try to add a tilde

    ~/.emacs.d/elpa

or the complete path:

    /home/user/.emacs.d/elpa/

to test, put a file test.el in ~/.emacs.d

    (setq load-path '("~/.emacs.d/"))
    (load "test.el")

This works for me, but not if I do without the tilde
and then do `cd' to another directory.

-- 
underground experts united
http://user.it.uu.se/~embe8573




^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: .emacs not loading libraries
  2015-10-17 12:58 .emacs not loading libraries Mart van de Wege
  2015-10-17 15:34 ` Emanuel Berg
@ 2015-10-17 15:38 ` Teemu Likonen
       [not found] ` <mailman.509.1445095516.7904.help-gnu-emacs@gnu.org>
       [not found] ` <mailman.512.1445096312.7904.help-gnu-emacs@gnu.org>
  3 siblings, 0 replies; 12+ messages in thread
From: Teemu Likonen @ 2015-10-17 15:38 UTC (permalink / raw)
  To: Mart van de Wege; +Cc: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 519 bytes --]

Mart van de Wege [2015-10-17 14:58:02+02] wrote:

> I've installed a bunch of libraries from elpa, and I found at least
> one of them is not available unless I do an explicit M-x load-library
>
> Now, I thought to add that to my .emacs, but neither (load-library
> "org-alert") nor (require 'org-alert) works. What am I doing wrong?

I think Elpa directories are not in load-path at the Emacs init time. If
you insert
    
    (package-initialize)

in your init file Emacs becoems aware of Elpa packages.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: .emacs not loading libraries
       [not found] ` <mailman.509.1445095516.7904.help-gnu-emacs@gnu.org>
@ 2015-10-17 18:59   ` Mart van de Wege
  2015-10-17 21:44     ` Emanuel Berg
       [not found]     ` <mailman.522.1445117721.7904.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 12+ messages in thread
From: Mart van de Wege @ 2015-10-17 18:59 UTC (permalink / raw)
  To: help-gnu-emacs

Emanuel Berg <embe8573@student.uu.se> writes:

Teemu had the right idea: in order to load elpa packages, I have to call
(package-initialize) in .emacs. Thanks for going the trouble.


Mart


-- 
"We will need a longer wall when the revolution comes."
    --- AJS, quoting an uncertain source.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: .emacs not loading libraries
       [not found] ` <mailman.512.1445096312.7904.help-gnu-emacs@gnu.org>
@ 2015-10-17 18:59   ` Mart van de Wege
  0 siblings, 0 replies; 12+ messages in thread
From: Mart van de Wege @ 2015-10-17 18:59 UTC (permalink / raw)
  To: help-gnu-emacs

Teemu Likonen <tlikonen@iki.fi> writes:

> Mart van de Wege [2015-10-17 14:58:02+02] wrote:
>
>> I've installed a bunch of libraries from elpa, and I found at least
>> one of them is not available unless I do an explicit M-x load-library
>>
>> Now, I thought to add that to my .emacs, but neither (load-library
>> "org-alert") nor (require 'org-alert) works. What am I doing wrong?
>
> I think Elpa directories are not in load-path at the Emacs init time. If
> you insert
>     
>     (package-initialize)
>
> in your init file Emacs becoems aware of Elpa packages.

Yes, that fixed it. Thanks.

-- 
"We will need a longer wall when the revolution comes."
    --- AJS, quoting an uncertain source.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: .emacs not loading libraries
  2015-10-17 18:59   ` Mart van de Wege
@ 2015-10-17 21:44     ` Emanuel Berg
       [not found]     ` <mailman.522.1445117721.7904.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 12+ messages in thread
From: Emanuel Berg @ 2015-10-17 21:44 UTC (permalink / raw)
  To: help-gnu-emacs

Mart van de Wege <mvdwege@gmail.com> writes:

> Teemu had the right idea: in order to load elpa
> packages, I have to call (package-initialize) in
> .emacs. Thanks for going the trouble.

OK, but still: Without the tilde in the `load-path', it
only works because probably when loading is done the
`default-directory' *is* your HOME!

Try this:

    $ touch .emacs.d/test.el

Then do this in Emacs:

    (setq load-path '(".emacs.d/"))
    (cd "~")
    (load "test.el") ; t
    (cd "..")
    (load "test.el") ; nil - doesn't work

Now instead do:

    (setq load-path '("~/.emacs.d/"))
    (cd "~")
    (load "test.el") ; t
    (cd "..")
    (load "test.el") ; t - works!

-- 
underground experts united
http://user.it.uu.se/~embe8573




^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: .emacs not loading libraries
       [not found]     ` <mailman.522.1445117721.7904.help-gnu-emacs@gnu.org>
@ 2015-10-17 22:29       ` Mart van de Wege
  2015-10-17 22:56         ` John Mastro
                           ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Mart van de Wege @ 2015-10-17 22:29 UTC (permalink / raw)
  To: help-gnu-emacs

Emanuel Berg <embe8573@student.uu.se> writes:

> Mart van de Wege <mvdwege@gmail.com> writes:
>
>> Teemu had the right idea: in order to load elpa
>> packages, I have to call (package-initialize) in
>> .emacs. Thanks for going the trouble.
>
> OK, but still: Without the tilde in the `load-path', it
> only works because probably when loading is done the
> `default-directory' *is* your HOME!

Yep. I was unclear, when I mention .emacs.d/elpa I meant relative to my
home dir; it has the tilde in it in the function calls adding it to my
load-path.

I've gotten pretty good at elisp, but until recently I stuck to
debian-packaged packages; only because I got seriously into org-mode for
my personal planning needs did I switch to elpa packages, because they
update a lot faster than Debian; and the one package I needed was
org-alert to alert me to my deadlines.

Your explanation was spot-on, hence the thanks for going to the trouble
of writing all that out.

Mart

-- 
"We will need a longer wall when the revolution comes."
    --- AJS, quoting an uncertain source.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: .emacs not loading libraries
  2015-10-17 22:29       ` Mart van de Wege
@ 2015-10-17 22:56         ` John Mastro
  2015-10-18 12:19           ` Emanuel Berg
       [not found]         ` <mailman.528.1445122641.7904.help-gnu-emacs@gnu.org>
  2015-10-18 12:14         ` Emanuel Berg
  2 siblings, 1 reply; 12+ messages in thread
From: John Mastro @ 2015-10-17 22:56 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org; +Cc: Mart van de Wege

Mart van de Wege <mvdwege@gmail.com> wrote:
> Yep. I was unclear, when I mention .emacs.d/elpa I meant relative to my
> home dir; it has the tilde in it in the function calls adding it to my
> load-path.

You don't need to add "~/.emacs.d/elpa/" to your `load-path'. If you
inspect the value of `load-path' (e.g. `C-h v load-path RET') you'll see
that it already contains entries for the packages you've installed via
ELPA - this is part of what package.el does for you.

-- 
john



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: .emacs not loading libraries
       [not found]         ` <mailman.528.1445122641.7904.help-gnu-emacs@gnu.org>
@ 2015-10-18  9:04           ` Mart van de Wege
  2015-10-18 14:29             ` Drew Adams
  0 siblings, 1 reply; 12+ messages in thread
From: Mart van de Wege @ 2015-10-18  9:04 UTC (permalink / raw)
  To: help-gnu-emacs

John Mastro <john.b.mastro@gmail.com> writes:

> Mart van de Wege <mvdwege@gmail.com> wrote:
>> Yep. I was unclear, when I mention .emacs.d/elpa I meant relative to my
>> home dir; it has the tilde in it in the function calls adding it to my
>> load-path.
>
> You don't need to add "~/.emacs.d/elpa/" to your `load-path'. If you
> inspect the value of `load-path' (e.g. `C-h v load-path RET') you'll see
> that it already contains entries for the packages you've installed via
> ELPA - this is part of what package.el does for you.

Hmm. That, of course, is obvious once it has been pointed out. Thanks.

Mart

-- 
"We will need a longer wall when the revolution comes."
    --- AJS, quoting an uncertain source.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: .emacs not loading libraries
  2015-10-17 22:29       ` Mart van de Wege
  2015-10-17 22:56         ` John Mastro
       [not found]         ` <mailman.528.1445122641.7904.help-gnu-emacs@gnu.org>
@ 2015-10-18 12:14         ` Emanuel Berg
  2 siblings, 0 replies; 12+ messages in thread
From: Emanuel Berg @ 2015-10-18 12:14 UTC (permalink / raw)
  To: help-gnu-emacs

Mart van de Wege <mvdwege@gmail.com> writes:

> Yep. I was unclear, when I mention .emacs.d/elpa
> I meant relative to my home dir; it has the tilde in
> it in the function calls adding it to my load-path.
>
> I've gotten pretty good at elisp, but until recently
> I stuck to debian-packaged packages; only because
> I got seriously into org-mode for my personal
> planning needs did I switch to elpa packages,
> because they update a lot faster than Debian; and
> the one package I needed was org-alert to alert me
> to my deadlines.
>
> Your explanation was spot-on, hence the thanks for
> going to the trouble of writing all that out.

My pleasure :)

But even more cred to the other guy who actually
solved the problem \o/

-- 
underground experts united
http://user.it.uu.se/~embe8573




^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: .emacs not loading libraries
  2015-10-17 22:56         ` John Mastro
@ 2015-10-18 12:19           ` Emanuel Berg
  0 siblings, 0 replies; 12+ messages in thread
From: Emanuel Berg @ 2015-10-18 12:19 UTC (permalink / raw)
  To: help-gnu-emacs

John Mastro <john.b.mastro@gmail.com> writes:

> You don't need to add "~/.emacs.d/elpa/" to your
> `load-path'. If you inspect the value of `load-path'
> (e.g. `C-h v load-path RET') you'll see that it
> already contains entries for the packages you've
> installed via ELPA - this is part of what package.el
> does for you.

And if anyone does the things I said for testing, that
will effectually erase everything else in the
`load-path' by setting it to something else - but that
was to show that the paths should be absolute - and
I think it was clear to everyone not to put that in
.emacs for good. Anyway erase and rewind to get the
old paths back :)

    https://www.youtube.com/watch?v=Mkv_2fQ-OLU

-- 
underground experts united
http://user.it.uu.se/~embe8573




^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: .emacs not loading libraries
  2015-10-18  9:04           ` Mart van de Wege
@ 2015-10-18 14:29             ` Drew Adams
  0 siblings, 0 replies; 12+ messages in thread
From: Drew Adams @ 2015-10-18 14:29 UTC (permalink / raw)
  To: Mart van de Wege, help-gnu-emacs

> > You don't need to add "~/.emacs.d/elpa/" to your `load-path'. If you
> > inspect the value of `load-path' (e.g. `C-h v load-path RET') you'll see
> > that it already contains entries for the packages you've installed via
> > ELPA - this is part of what package.el does for you.
> 
> Hmm. That, of course, is obvious once it has been pointed out. Thanks.

FWIW, I just filed bug #21704, asking that the package.el doc
mention the effects on `load-path'.

http://debbugs.gnu.org/cgi/bugreport.cgi?bug=21704



^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2015-10-18 14:29 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-17 12:58 .emacs not loading libraries Mart van de Wege
2015-10-17 15:34 ` Emanuel Berg
2015-10-17 15:38 ` Teemu Likonen
     [not found] ` <mailman.509.1445095516.7904.help-gnu-emacs@gnu.org>
2015-10-17 18:59   ` Mart van de Wege
2015-10-17 21:44     ` Emanuel Berg
     [not found]     ` <mailman.522.1445117721.7904.help-gnu-emacs@gnu.org>
2015-10-17 22:29       ` Mart van de Wege
2015-10-17 22:56         ` John Mastro
2015-10-18 12:19           ` Emanuel Berg
     [not found]         ` <mailman.528.1445122641.7904.help-gnu-emacs@gnu.org>
2015-10-18  9:04           ` Mart van de Wege
2015-10-18 14:29             ` Drew Adams
2015-10-18 12:14         ` Emanuel Berg
     [not found] ` <mailman.512.1445096312.7904.help-gnu-emacs@gnu.org>
2015-10-17 18:59   ` Mart van de Wege

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).