Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autoloading problems with org-mode #135

Closed
cubranic opened this issue Dec 10, 2014 · 17 comments
Closed

Autoloading problems with org-mode #135

cubranic opened this issue Dec 10, 2014 · 17 comments

Comments

@cubranic
Copy link

When I try to use org-mode with:

(use-package org
  :bind ("C-c c" . org-capture))

when I press "C-c c", I get the following error message: "Autoloading failed to define function org-capture".

I can solve this in two ways, but both seem kludgey:

  1. add :demand keyword
  2. do the binding as part of :init, which works even if I defer the loading of the package:
(use-package org
  :defer t
  :init
  (bind-key "C-c c" 'org-capture))

Since workaround 2 does not mess up the auto loads, is there a bug in how using :bind sets them up?

@npostavs
Copy link
Contributor

I expect this should work:

(use-package org-package
  :bind ("C-c c" . org-capture))

@cubranic
Copy link
Author

It fails with this message: "Cannot open load file: no such file or directory, org-package"

@npostavs
Copy link
Contributor

Crap sorry, I had a thinko. I meant

(use-package org-capture
  :bind ("C-c c" . org-capture))

@cubranic
Copy link
Author

The package on ELPA is named “org”, so that’s what I used. This is just a minimally reproducible example, my configuration uses many other commands from it, not just org-capture.

On Dec 10, 2014, at 2:27 PM, Noam Postavsky notifications@github.com wrote:

Crap sorry, I had a thinko. I meant

(use-package org-capture
:bind ("C-c c" . org-capture))

Reply to this email directly or view it on GitHub.

@npostavs
Copy link
Contributor

use-package doesn't work at the level of ELPA packages. It doesn't really have a way to know that some commands in (use-package org ...) come from org.el and others come from org-capture.el.

Maybe use-package should stop creating autoloads since the package manager takes care of it anyway (I think use-package's autoloading features come from before ELPA was widely used).

@cubranic
Copy link
Author

This is org-mode that comes bundled with Emacs, not installed from a package repo. So whatever autoloads are set up out of the box are fine, until :bind messes with them. Maybe binding in “:init” is the right thing to do then, if there is no way around reconciling the multiple .el files that different commands come from in this case.

org-version: 8.2.10
emacs-version: 24.4.1

On Dec 10, 2014, at 2:44 PM, Noam Postavsky notifications@github.com wrote:

use-package doesn't work at the level of ELPA packages. It doesn't really have a way to know that some commands in (use-package org ...) come from org.el and others come from org-capture.el.

Maybe use-package should stop creating autoloads since the package manager takes care of it anyway (I think use-package's autoloading features come from before ELPA was widely used).


Reply to this email directly or view it on GitHub.

@YoungFrog
Copy link
Contributor

Does this patch fix the problem ? YoungFrog/use-package@6f392b1

@cubranic
Copy link
Author

How do I try it out so it’s picked up instead of the version I currently have from MELPA? Is there a variant of “package-install” where I can give it a repo URL or local directory?

On Dec 11, 2014, at 2:49 AM, Nicolas Richard notifications@github.com wrote:

Does this patch fix the problem ? YoungFrog/use-package@6f392b1


Reply to this email directly or view it on GitHub.

@cubranic
Copy link
Author

Nevermind, I just patched it directly in my "elpa" directory. Yes, it worked.

@peterhoeg
Copy link
Contributor

@YoungFrog are you planning on a PR for your fix?

@YoungFrog
Copy link
Contributor

Le 17/12/2014 18:16, Peter Hoeg a écrit :

@YoungFrog are you planning on a PR for your fix?

Oops, sorry about that ! Clicking on buttons is hard :)

Done now. I even rebased the change on top of master. I hope I didn't
forget anything, if I did I promise the fix will come faster :)

@thomasf
Copy link
Contributor

thomasf commented Mar 13, 2015

Mine just look like this, some of the :commands are just functions defined in my :config

(use-package org
  :ensure org-plus-contrib
  :commands (org
             org-capture
             org-mode
             org-store-link
             update-org-hours
             my-term-agenda
             dired-notes
             jump-to-org-agenda)
  :mode (("\\.org_archive\\'" . org-mode)
         ("\\.org\\'" . org-mode))
...

@YoungFrog
Copy link
Contributor

@thomasf I'm sorry I'm not sure I followed you. Do I understand right that you are reporting something to work around the initial problem ?

@thomasf
Copy link
Contributor

thomasf commented Mar 13, 2015

Oh, yes.. I think I misread the situation, followed too many links without checking the context.

@jwiegley
Copy link
Owner

@thomasf Is there still work needing to be done here, or should we close this? I had to revert @YoungFrog's fix mentioned above, so if that still needs to be addressed, we should open a new issue for it.

@jwiegley
Copy link
Owner

@cubranic use-package should not clobber your autoloads anymore, can you please see if this issue is still a problem for you?

@chuchana
Copy link
Contributor

@thomasf Thank you!

I had to look through the list of issues until I found this, so it would be nice to add something like this to the readme:

If you get an error like Symbol's value as variable is void: name, you have probably used the wrong package name. For example, you have to add org-plus-contrib like this:

(use-package org
  :ensure org-plus-contrib)

I am not sure where, though. At the bottom, in a new section called Errors?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants