help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: compile-defun of function in package.el has no effect


From: Michael Heerdegen
Subject: Re: compile-defun of function in package.el has no effect
Date: Mon, 19 Oct 2015 13:54:51 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

eric.scott@acm.org writes:

> I'm having some trouble getting a package (elpy) installed with the
> package manager,

FWIW; I can install it without any problems with my Emacs 25.

> and thought I'd take this as an opportunity to learn a little bit
> about how package.el works. However, I'm finding it hard to add
> tracing statements because no changes I make in the code seem to be
> taking.
>
> For example I added the word 'the' to this expression in
> package.el/package-menu-execute():
>
>       (if (yes-or-no-p
>          (if (= (length install-list) 1)
>              (format "Install the package `%s'? " (car
> install-list))
>                ...))))
>
> then executed M-x compile-defun on it.

The standard way to eval a piece of code in a buffer is to put the
cursor after it and hit C-x C-e, but AFAICT M-x compile-defun should
work as well.

> There were no complaints, but when I tried again to install the
> package, my edit did not appear i.e.: instead of "Install the package
> 'elpy'?" I got the old version 'Install package 'elpy'?
>
> As I understand it, 'compile-defun should dynamically bind the
> byte-compiled new definition to the unique symbol
> 'package-menu-execute, but clearly it's not binding it, or the symbol
> is not unique, or something is coming along later and changing it
> back.

You can check the function binding of a symbol; in this case:

  M-: (symbol-function 'package-menu-execute) RET

This may be byte code of course.

> The value of M-x locate-library <package> is
> /usr/share/emacs/24.3/lisp/emacs-lisp/package.elc
>
> I tried byte-compiling the whole package.el file (as linked from the
> stack trace) and copying it to that position, and there is still no
> effect after restarting.

Are you sure you are changing the right function?  You can check with
`trace-function'.

> BTW, the error I'm getting when trying to install elpy is 'package
> emacs-24.1 is unavailable'. I'm running v 24.3.

Dunno why you get this.  But if you are able to modify files under
"/usr/share/emacs/24.3/lisp/emacs-lisp" (not a good idea IMHO, you may
risk breaking your whole installation), maybe you can just upgrade to a
more recent Emacs version?  The problem may be gone then.


Michael.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]