2

I.e In elisp, from inside an .el file, you can make functions global like this: (provide 'org-pomodoro)

Now, in my personal .emacs, I would like to access (pull in?) a function that's internal to a library (org-pomodoro) but without actually changing org-pomodoro (as I'm not the maintainer of the package).

e.g I want to access org-pomodoro-finish myself to implement the functionality of switching between a task and continuing the pomodoro in another task.

For this I also need to be able to access a count-variable. (e.g like ~~org-pomodoro-time)

[edit]
The solution below works quite well. I can just evaluate (org-pomodoro-finished) and a pomodoro is finished ahead of time. I can then write my own function that will be listed in M-x for convienience.

Thank you so much, this opens many doors for me.

4

Emacs Lisp doesn't have a module system, and all symbols are global.

What provide does is simply putting its parameter onto the list of loaded modules. require checks the list, and ensures that the given module has been loaded.

So in order to access the org-pomodoro-finish function, you just need to ensure that the org-pomodoro module has been loaded:

(require 'org-pomodoro)
(org-pomodoro-finish ...)
  • I'm slightly confused. So Elisp has no module system... so just pull in this module and everything will be fine? – PythonNut Feb 13 '15 at 17:11
  • I apologize for my elips ignorance. Thank you for help :-D. – Leo Ufimtsev Feb 13 '15 at 17:11
  • @PythonNut, yes. Emacs Lisp doesn't have a module system, but it has a primitive notion of module -- a module is just a file ending in a call to provide. – jch Feb 13 '15 at 17:34
  • @jch I see. I suppose I'm confusing a module system with the existence of modules. Thanks! – PythonNut Feb 13 '15 at 17:51
  • I wouldn't use the word "module". Instead, the model here is that whenever a source file is loaded, its definitions are added to the one, shared namespace everything can see. That's why the naming convention is so important, and e.g. you see everything from org named with a org- prefix. The require is only to make sure it's loaded, not to give you visibility or access. If it happened to already be loaded, you would already be able to access its definitions, even without the require. – Greg Hendershott Feb 13 '15 at 21:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.