* Emacs Package Loading & .emacs ??
@ 2014-03-31 4:49 David Masterson
2014-03-31 7:43 ` Martin
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: David Masterson @ 2014-03-31 4:49 UTC (permalink / raw)
To: help-gnu-emacs
I used the Emacs package menu to install the latest version of Org
(8.2.5h). It installed it into ~/.emacs.d/elpa as you would expect.
Now, I'm trying to initialize Org and make proper use of it, but it
appears that the new Org package is not initializing right and, instead,
I am picking up the one that came with Emacs 24.3 as describe-variable
on org-version reports 7.9.3f. Yet, I see the new Org's directory on
the load-path, so something ran.
Can someone explain the package loading process? In particular, I get
the sense that the new package is added to the load-path *after* my
.emacs is loaded. If that is true, what is the proper way to make use
of the new package as adding (require 'org) to my .emacs will pick up
the original Org and not the installed package? Should I physically
delete the original Org module that came with Emacs?
--
David Masterson
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Emacs Package Loading & .emacs ??
2014-03-31 4:49 Emacs Package Loading & .emacs ?? David Masterson
@ 2014-03-31 7:43 ` Martin
2014-03-31 17:18 ` W. Greenhouse
[not found] ` <mailman.18607.1396286371.10748.help-gnu-emacs@gnu.org>
2 siblings, 0 replies; 9+ messages in thread
From: Martin @ 2014-03-31 7:43 UTC (permalink / raw)
To: help-gnu-emacs
David Masterson writes:
> I used the Emacs package menu to install the latest version of Org
> (8.2.5h). It installed it into ~/.emacs.d/elpa as you would expect.
> Now, I'm trying to initialize Org and make proper use of it, but it
> appears that the new Org package is not initializing right and, instead,
> I am picking up the one that came with Emacs 24.3 as describe-variable
> on org-version reports 7.9.3f. Yet, I see the new Org's directory on
> the load-path, so something ran.
>
> Can someone explain the package loading process? In particular, I get
> the sense that the new package is added to the load-path *after* my
> .emacs is loaded. If that is true, what is the proper way to make use
> of the new package as adding (require 'org) to my .emacs will pick up
> the original Org and not the installed package? Should I physically
> delete the original Org module that came with Emacs?
Hi,
uninstall the old version ?
<menu-bar> <package-menu> <md> runs the command
package-menu-mark-delete, which is an interactive compiled Lisp
function in `package.el'.
It is bound to d, <menu-bar> <package-menu> <md>.
(package-menu-mark-delete &optional NUM)
Mark a package for deletion and move to the next line.
Martin
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Emacs Package Loading & .emacs ??
2014-03-31 4:49 Emacs Package Loading & .emacs ?? David Masterson
2014-03-31 7:43 ` Martin
@ 2014-03-31 17:18 ` W. Greenhouse
2014-04-01 11:49 ` Alan Schmitt
[not found] ` <mailman.18607.1396286371.10748.help-gnu-emacs@gnu.org>
2 siblings, 1 reply; 9+ messages in thread
From: W. Greenhouse @ 2014-03-31 17:18 UTC (permalink / raw)
To: help-gnu-emacs-mXXj517/zsQ
David Masterson <dsmasterson-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:
[...]
> Can someone explain the package loading process? In particular, I get
> the sense that the new package is added to the load-path *after* my
> .emacs is loaded.
Exactly right. (info "(elisp) Startup Summary") details the whole init
process. In particular, note:
12. It loads your init file (*note Init File::). This is not done if
the options `-q', `-Q', or `--batch' were specified. If the `-u'
option was specified, Emacs looks for the init file in that user's
home directory instead.
...
15. If `package-enable-at-startup' is non-`nil', it calls the function
`package-initialize' to activate any optional Emacs Lisp package
that has been installed. *Note Packaging Basics::.
Note that `package-initialize' doesn't actually "load" packages either.
What it does is populate `load-path' with the locations of package
libraries, and scan the packages for autoloads. The package normally
doesn't get loaded at all until one of these autoloads is triggered.
> If that is true, what is the proper way to make use of the new package
> as adding (require 'org) to my .emacs will pick up the original Org
> and not the installed package? Should I physically delete the original
> Org module that came with Emacs?
No, don't attempt to delete stuff that came with Emacs.
1. You probably don't need to use (require 'org) at all. The idea of
packages is that autoloads will be set up so that when you call one
of the main entry points of a package (e.g. `org-mode', `org-agenda',
`org-capture', etc.), the package will load the correct version.
Explicitly requiring or loading the library before the package is
loaded will foul this up. You can set package-related variables and
even add to hooks before they are defined by the library, so (require
'org) doesn't actually do much that is useful but take up time during
init. Customize also does the right thing automatically, in that
setting package settings through Customize won't accidentally load
the built-in version of the package.
2. The correct form would be (require 'org-install) anyway, if you were
manually loading org.
3. If you decide for some reason that you really do need to use
(require 'org-install), you should do this from `after-init-hook'
(which is run at step 17 of (info "(elisp) Startup Summary"), well
after package init), OR you can explicitly (package-initialize) early
in init and (setq package-enable-at-startup nil) to skip step 15.
above. (info "(emacs) Package Installation") details some of the
pros and cons of each approach.
There's also https://github.com/jwiegley/use-package, a macro to
simplify package-related config without doing explicit loads. You can
change which functions will auto-load the package, and set variables and
run functions in a "lazy" way such that nothing much will happen at init
but these changes will be applied when the library is actually loaded
for the first time.
It's complicated, but I hope this helps.
--
WGG
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Emacs Package Loading & .emacs ??
[not found] ` <mailman.18607.1396286371.10748.help-gnu-emacs@gnu.org>
@ 2014-03-31 23:43 ` David Masterson
2014-03-31 23:51 ` David Masterson
2014-04-01 14:42 ` W. Greenhouse
0 siblings, 2 replies; 9+ messages in thread
From: David Masterson @ 2014-03-31 23:43 UTC (permalink / raw)
To: help-gnu-emacs
W. Greenhouse <wgreenhouse@riseup.net> writes:
> David Masterson <dsmasterson@gmail.com> writes:
>
>> Can someone explain the package loading process? In particular, I get
>> the sense that the new package is added to the load-path *after* my
>> .emacs is loaded.
>
> Exactly right. (info "(elisp) Startup Summary") details the whole init
> process. In particular, note:
>
> 12. It loads your init file (*note Init File::). This is not done if
> the options `-q', `-Q', or `--batch' were specified. If the `-u'
> option was specified, Emacs looks for the init file in that user's
> home directory instead.
>
> ...
>
> 15. If `package-enable-at-startup' is non-`nil', it calls the function
> `package-initialize' to activate any optional Emacs Lisp package
> that has been installed. *Note Packaging Basics::.
>
> Note that `package-initialize' doesn't actually "load" packages either.
> What it does is populate `load-path' with the locations of package
> libraries, and scan the packages for autoloads. The package normally
> doesn't get loaded at all until one of these autoloads is triggered.
Something is not right here. I have done a package install on Org
(8.2.5h), but, if I blank out my .emacs, then org-version is set to
7.9.3f.
>> If that is true, what is the proper way to make use of the new package
>> as adding (require 'org) to my .emacs will pick up the original Org
>> and not the installed package? Should I physically delete the original
>> Org module that came with Emacs?
>
> No, don't attempt to delete stuff that came with Emacs.
>
> 1. You probably don't need to use (require 'org) at all. The idea of
> packages is that autoloads will be set up so that when you call one
> of the main entry points of a package (e.g. `org-mode', `org-agenda',
> `org-capture', etc.), the package will load the correct version.
> Explicitly requiring or loading the library before the package is
> loaded will foul this up. You can set package-related variables and
> even add to hooks before they are defined by the library, so (require
> 'org) doesn't actually do much that is useful but take up time during
> init. Customize also does the right thing automatically, in that
> setting package settings through Customize won't accidentally load
> the built-in version of the package.
As mentioned above, if I don't (require 'org) at the right time, then
the wrong version of org is loaded. Since org-version is already
defined, then that means that Org has already been loaded and, so, there
is no need to reload it. The only problem is that it is that wrong one.
> 2. The correct form would be (require 'org-install) anyway, if you were
> manually loading org.
>
> 3. If you decide for some reason that you really do need to use
> (require 'org-install), you should do this from `after-init-hook'
> (which is run at step 17 of (info "(elisp) Startup Summary"), well
> after package init), OR you can explicitly (package-initialize) early
> in init and (setq package-enable-at-startup nil) to skip step 15.
> above. (info "(emacs) Package Installation") details some of the
> pros and cons of each approach.
Hmmm. I'll have to recheck that. This goes against the standard way of
loading Emacs libraries that I've been using for 20+ years! Never needed
to use after-init-hook before. It's so hard to teach an old dog new
tricks...
--
David Masterson
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Emacs Package Loading & .emacs ??
2014-03-31 23:43 ` David Masterson
@ 2014-03-31 23:51 ` David Masterson
2014-04-01 1:38 ` Rusi
2014-04-01 14:42 ` W. Greenhouse
1 sibling, 1 reply; 9+ messages in thread
From: David Masterson @ 2014-03-31 23:51 UTC (permalink / raw)
To: help-gnu-emacs
David Masterson <dsmasterson@gmail.com> writes:
> W. Greenhouse <wgreenhouse@riseup.net> writes:
>> 2. The correct form would be (require 'org-install) anyway, if you were
>> manually loading org.
>>
>> 3. If you decide for some reason that you really do need to use
>> (require 'org-install), you should do this from `after-init-hook'
>> (which is run at step 17 of (info "(elisp) Startup Summary"), well
>> after package init), OR you can explicitly (package-initialize) early
>> in init and (setq package-enable-at-startup nil) to skip step 15.
>> above. (info "(emacs) Package Installation") details some of the
>> pros and cons of each approach.
>
> Hmmm. I'll have to recheck that. This goes against the standard way of
> loading Emacs libraries that I've been using for 20+ years! Never needed
> to use after-init-hook before. It's so hard to teach an old dog new
> tricks...
Nope -- still not getting it...
I tried adding (require 'org-install) to the after-init-hook. No errors
showed up, but org-version is still 7.9.3f.
--
David Masterson
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Emacs Package Loading & .emacs ??
2014-03-31 23:51 ` David Masterson
@ 2014-04-01 1:38 ` Rusi
0 siblings, 0 replies; 9+ messages in thread
From: Rusi @ 2014-04-01 1:38 UTC (permalink / raw)
To: help-gnu-emacs
On Tuesday, April 1, 2014 5:21:11 AM UTC+5:30, David Masterson wrote:
> David Masterson writes:
> > W. Greenhouse writes:
> >> 2. The correct form would be (require 'org-install) anyway, if you were
> >> manually loading org.
> >> 3. If you decide for some reason that you really do need to use
> >> (require 'org-install), you should do this from `after-init-hook'
> >> (which is run at step 17 of (info "(elisp) Startup Summary"), well
> >> after package init), OR you can explicitly (package-initialize) early
> >> in init and (setq package-enable-at-startup nil) to skip step 15.
> >> above. (info "(emacs) Package Installation") details some of the
> >> pros and cons of each approach.
> > Hmmm. I'll have to recheck that. This goes against the standard way of
> > loading Emacs libraries that I've been using for 20+ years! Never needed
> > to use after-init-hook before. It's so hard to teach an old dog new
> > tricks...
> Nope -- still not getting it...
> I tried adding (require 'org-install) to the after-init-hook. No errors
> showed up, but org-version is still 7.9.3f.
Ive not yet migrated to the new package system (so what I say may have
no relation with your needs)
However Ive had problems with recent org not properly shadowing the builtin
one properly.
Ive 'cured' (you may call it bludgeoned) that problem out by doing
(load-file (expand-file-name "~/path/to/org-loaddefs.el"))
followed by this (which should be superseded by some package stuff)
(add-to-list 'load-path "~/path/to//org-mode/contrib/lisp")
After that (require 'org) is not required!
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Emacs Package Loading & .emacs ??
2014-03-31 17:18 ` W. Greenhouse
@ 2014-04-01 11:49 ` Alan Schmitt
2014-04-01 14:44 ` W. Greenhouse
0 siblings, 1 reply; 9+ messages in thread
From: Alan Schmitt @ 2014-04-01 11:49 UTC (permalink / raw)
To: W. Greenhouse; +Cc: help-gnu-emacs
W. Greenhouse <wgreenhouse@riseup.net> writes:
> 2. The correct form would be (require 'org-install) anyway, if you were
> manually loading org.
I'm surprised by this. Looking at the org-install.el file in my local
installation, I see this:
#+begin_src emacs-lisp
;;; org-install.el --- backward compatibility file for obsolete configuration
;;
;;; Code:
;;
;; The file org-install is obsolete.
;;
;; It is provided here so that (require 'org-install) does not
;; trigger an error for users with obsolete Emacs configuration.
;; You can safely remove (require 'org-install) from your config."
(provide 'org-install)
;; Local Variables:
;; no-byte-compile: t
;; coding: utf-8
;; End:
;;; org-install.el ends here
#+end_src
Alan
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Emacs Package Loading & .emacs ??
2014-03-31 23:43 ` David Masterson
2014-03-31 23:51 ` David Masterson
@ 2014-04-01 14:42 ` W. Greenhouse
1 sibling, 0 replies; 9+ messages in thread
From: W. Greenhouse @ 2014-04-01 14:42 UTC (permalink / raw)
To: help-gnu-emacs-mXXj517/zsQ
David Masterson <dsmasterson-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:
> As mentioned above, if I don't (require 'org) at the right time, then
> the wrong version of org is loaded. Since org-version is already
> defined, then that means that Org has already been loaded and, so, there
> is no need to reload it. The only problem is that it is that wrong one.
Indeed, `require' doesn't do anything if a library fitting that feature name
(`provide' form) is already loaded. So there should be nothing magical
about `require' here that would cause it to load the correct org.
>> 2. The correct form would be (require 'org-install) anyway, if you were
>> manually loading org.
>>
>> 3. If you decide for some reason that you really do need to use
>> (require 'org-install), you should do this from `after-init-hook'
>> (which is run at step 17 of (info "(elisp) Startup Summary"), well
>> after package init), OR you can explicitly (package-initialize) early
>> in init and (setq package-enable-at-startup nil) to skip step 15.
>> above. (info "(emacs) Package Installation") details some of the
>> pros and cons of each approach.
>
> Hmmm. I'll have to recheck that. This goes against the standard way of
> loading Emacs libraries that I've been using for 20+ years! Never needed
> to use after-init-hook before. It's so hard to teach an old dog new
> tricks...
The after-init-hook method works for me. What config did you use?
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Emacs Package Loading & .emacs ??
2014-04-01 11:49 ` Alan Schmitt
@ 2014-04-01 14:44 ` W. Greenhouse
0 siblings, 0 replies; 9+ messages in thread
From: W. Greenhouse @ 2014-04-01 14:44 UTC (permalink / raw)
To: help-gnu-emacs-mXXj517/zsQ
Alan Schmitt <alan.schmitt-o/5/jSaJEHk+NdeTPqioyti2O/JbrIOy@public.gmane.org> writes:
> I'm surprised by this. Looking at the org-install.el file in my local
> installation, I see this:
Okay, thanks. My mistake--I still have this lingering and now-unneeded
reference in my init.el.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2014-04-01 14:44 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-31 4:49 Emacs Package Loading & .emacs ?? David Masterson
2014-03-31 7:43 ` Martin
2014-03-31 17:18 ` W. Greenhouse
2014-04-01 11:49 ` Alan Schmitt
2014-04-01 14:44 ` W. Greenhouse
[not found] ` <mailman.18607.1396286371.10748.help-gnu-emacs@gnu.org>
2014-03-31 23:43 ` David Masterson
2014-03-31 23:51 ` David Masterson
2014-04-01 1:38 ` Rusi
2014-04-01 14:42 ` W. Greenhouse
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).