elpa package loading problem?

268 views
Skip to first unread message

Xah Lee

unread,
Jun 2, 2012, 12:44:29 PM6/2/12
to
does anyone have problems with emacs package system?

recently, installed several packages with it: {“rainbow-mode”,
“bookmark+”, “smex”, “expand-region”}.

But they all have a similar problem related to autoload. For example,
let's say rainbow-mode. When in css, it's not loaded. You have to
manually call it. So, if you want it to load automatically when in
css, you have to add stuff to your init file. Then, this means the
package system does not really automatically manage things. You still
have know some elisp, and manually add things to your init file. (we
talking about basic activation, not advanced customization)

The issue is more pronounced with modes such as bookmark+, smex,
expand-region. For example, in bookmark+, when i start my emacs, call
bookmark 【Ctrl+x r l】, it gives a error about some current-bookmark-
file var not defined. Apparently, the problem is that bookmark+ must
be properly initialized before i start my bookmark. (when calling
bookmark-bmenu-list, it does automatically load bookmark+, but isn't
properly initialized) Here, i've spent some 20 min but haven't
succeeded in making it work. (i suppose i'll need to take time to
understand how elpa loading mechanism works.)

Similar things happen with smex, expand-region. For example, smex
requires you to define a key for M-x. So i added (global-set-key (kbd
"<apps>") 'smex) in my init. But after starting emacs, i press the
apps key, i get: “Symbol's function definition is void: smex”. If i
put (require 'smex), restart, i get “Debugger entered--Lisp error:
(file-error "Cannot open load file" "smex")”. Next step is to add the
load path, which i haven't tried yet. But that seems to defeat half of
goodness of package system.

Any insight on this?

for emacs 24, is this the way things are?

José A. Romero L.

unread,
Jun 4, 2012, 4:58:03 AM6/4/12
to
W dniu sobota, 2 czerwca 2012 18:44:29 UTC+2 użytkownik Xah Lee napisał:
> does anyone have problems with emacs package system?
>
> recently, installed several packages with it: {“rainbow-mode”,
> “bookmark+”, “smex”, “expand-region”}.
(...)
> apps key, i get: “Symbol's function definition is void: smex”. If i
(...)
> Any insight on this?

AFAIK, ELPA relies heavily on correctly declared autoload cookies,
especially if you really want to avoid loading whole packages at
startup. From my own experience adapting SC to ELPA I know this is
not easy to get right from the beginning -- you, as a user, may end
needing to add the missing autoloads to the xxx-autoloads.el file
automatically generated by ELPA (this sucks big time, because your
added code is ditched away with every upgrade of the package). ELPA
works wonderfully well, but only if the authors of the packages you
happen to use did make that extra effort to get things right from the
start.

> for emacs 24, is this the way things are?

Yep, that's just the way it is. I'm afraid you'll have to submit a
few bug reports before things start working properly for you.

Cheers,
--
José A. Romero L.
escherdragon at gmail
"We who cut mere stones must always be envisioning cathedrals."
(Quarry worker's creed)

José A. Romero L.

unread,
Jun 4, 2012, 3:18:42 PM6/4/12
to
> (...)
> > apps key, i get: “Symbol's function definition is void: smex”. If i
> (...)

BTW, for smex I've added this to my .emacs:

(defun jarl/smex ()
(interactive)
(condition-case description
(progn
(smex-initialize)
(global-set-key (kbd "M-x") 'smex)
(global-set-key (kbd "M-X") 'smex-major-mode-commands)
(global-set-key (kbd "C-c C-c M-x") 'execute-extended-command)
(smex))
(error (execute-extended-command))))
(global-set-key (kbd "M-x") 'jarl/smex)

Xah Lee

unread,
Jun 4, 2012, 7:09:05 PM6/4/12
to
Thanks a lot Jose. Very informative.

Xah

Easior

unread,
Nov 29, 2012, 2:09:52 AM11/29/12
to Xah Lee, help-gn...@gnu.org
>>>>> "XL" == Xah Lee <xah...@gmail.com> writes:

XL> does anyone have problems with emacs package system?
XL> recently, installed several packages with it: {“rainbow-mode”,
XL> “bookmark+”, “smex”, “expand-region”}.

XL> But they all have a similar problem related to autoload. For example,
XL> let's say rainbow-mode. When in css, it's not loaded. You have to
XL> manually call it. So, if you want it to load automatically when in
XL> css, you have to add stuff to your init file. Then, this means the
XL> package system does not really automatically manage things. You still
XL> have know some elisp, and manually add things to your init file. (we
XL> talking about basic activation, not advanced customization)

XL> The issue is more pronounced with modes such as bookmark+, smex,
XL> expand-region. For example, in bookmark+, when i start my emacs, call
XL> bookmark 【Ctrl+x r l】, it gives a error about some current-bookmark-
XL> file var not defined. Apparently, the problem is that bookmark+ must
XL> be properly initialized before i start my bookmark. (when calling
XL> bookmark-bmenu-list, it does automatically load bookmark+, but isn't
XL> properly initialized) Here, i've spent some 20 min but haven't
XL> succeeded in making it work. (i suppose i'll need to take time to
XL> understand how elpa loading mechanism works.)

XL> Similar things happen with smex, expand-region. For example, smex
XL> requires you to define a key for M-x. So i added (global-set-key (kbd
XL> "<apps>") 'smex) in my init. But after starting emacs, i press the
XL> apps key, i get: “Symbol's function definition is void: smex”. If i
XL> put (require 'smex), restart, i get “Debugger entered--Lisp error:
XL> (file-error "Cannot open load file" "smex")”. Next step is to add the
XL> load path, which i haven't tried yet. But that seems to defeat half of
XL> goodness of package system.

XL> Any insight on this?

XL> for emacs 24, is this the way things are?

It's just my question.

However, I also found something strange with package.el in emacs 24.
I installed command-frequency.el, info+.el, maxfame.el etc, by elpa.
Those package couldn't load properly if I add the following lines:

,------------------------------------------------
| (require 'command-frequency)
| (eval-after-load "info" '(require 'info+))
| (require 'maxframe)
| (add-hook 'window-setup-hook 'maximize-frame t)
`------------------------------------------------

to the file ~/.emacs. The *Bugtrace* reports that

If I adjust my dotemacs file as follows

,------------------------------------------------
| ;; (require 'command-frequency)
| ;; (eval-after-load "info" '(require 'info+))
| ;; (require 'maxframe)
| (add-hook 'window-setup-hook 'maximize-frame t)
`------------------------------------------------

then the maxframe.el works well while command-frequency.el and
info+.el didn't take any effects. I found those files named
<package>-<autoloads>.el when I entered into the elpa directory.
Based on these facts, I understand that

* packages installed by elpa couldn't required in ~/.emacs since
they would be autoloaded through the autoloads files. Furthermore,
the autoloads files are generated from the ;;##autoload lines in
package sources.
* maxfame.el works since the function, maximize-frame, is in the
autoloads file.
* command-frequency.el doesn't work because there is nothing in its
autoloads file.

Is it right?

Question:

Is there a way to make info+.el, command-frequency.el run by elpa?
What can I do?

Thanks in advance.

Best regards,

Easior
-----
Ich bin von heute und ehedam, aber etwas ist in mir, das ist vor
morgen und übermorgen und einstmal.

Friedrich Wilhelm Nietzsche


Jude DaShiell

unread,
Nov 29, 2012, 11:18:59 PM11/29/12
to Easior, help-gn...@gnu.org, Xah Lee

I predict your time will be better spent reading through the tops of those
.el files which is the lisp source code that elpa downloaded for you. The
elpa package isn't responsible for modifying your .emacs file that's for
people on the recieving system to do. Sometimes package paths will have
to be added to the emacs PATH variable too.

---------------------------------------------------------------------------
jude <jdas...@shellworld.net> Adobe fiend for failing to Flash



Xah Lee

unread,
Nov 29, 2012, 11:53:44 PM11/29/12
to
On Nov 28, 11:09 pm, Easior <eas...@126.com> wrote:
> …
> It's just my question.
>
> However, I also found something strange with package.el in emacs 24.
> I installed command-frequency.el, info+.el, maxfame.el etc, byelpa.
> Those package couldn't load properly if I add the following lines:
>
> ,------------------------------------------------
> | (require 'command-frequency)
> | (eval-after-load "info" '(require 'info+))
> | (require 'maxframe)
> | (add-hook 'window-setup-hook 'maximize-frame t)
> `------------------------------------------------
>
> to the file ~/.emacs. The *Bugtrace* reports that
>
> If I adjust my dotemacs file as follows
>
> ,------------------------------------------------
> | ;; (require 'command-frequency)
> | ;; (eval-after-load "info" '(require 'info+))
> | ;; (require 'maxframe)
> | (add-hook 'window-setup-hook 'maximize-frame t)
> `------------------------------------------------
>
> then the maxframe.el works well while command-frequency.el and
> info+.el didn't take any effects. I found those files named
> <package>-<autoloads>.el when I entered into theelpadirectory.
> Based on these facts, I understand that
>
> * packages installed byelpacouldn't required in ~/.emacs since
>   they would be autoloaded through the autoloads files. Furthermore,
>   the autoloads files are generated from the ;;##autoload lines in
>   package sources.
> * maxfame.el works since the function, maximize-frame, is in the
>   autoloads file.
> * command-frequency.el doesn't work because there is nothing in its
>   autoloads file.
>
> Is it right?
>
> Question:
>
> Is there a way to make info+.el, command-frequency.el run byelpa?
> What can I do?
>
> Thanks in advance.
>
> Best regards,
>
> Easior
> -----
> Ich bin von heute und ehedam, aber etwas ist in mir, das ist vor
> morgen und übermorgen und einstmal.
>
>                                      Friedrich Wilhelm Nietzsche


in general, you want to do

(package-initialize)

first before trying to do any config for packages from the package
system.

See update here, bottom:

〈Emacs 24 Package System Problems〉
http://ergoemacs.org/emacs/emacs_package_system_problem.html

also, i recommend using MELPA.

〈A Guide on Emacs 24 Package System〉
http://ergoemacs.org/emacs/emacs_package_system.html

command-frequency is obsolete. New is keyfreq.el. Please see bottom:

〈Emacs's Command Frequency〉
http://ergoemacs.org/emacs/command-frequency.html

Xah
Reply all
Reply to author
Forward
0 new messages