* compile-defun of function in package.el has no effect
@ 2015-10-18 16:48 eric.scott
2015-10-19 11:54 ` Michael Heerdegen
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: eric.scott @ 2015-10-18 16:48 UTC (permalink / raw)
To: help-gnu-emacs
I'm having some trouble getting a package (elpy) installed with the package manager, 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. 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.
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.
BTW, the error I'm getting when trying to install elpy is 'package emacs-24.1 is unavailable'. I'm running v 24.3.
Any help would be appreciated.
Thanks,
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: compile-defun of function in package.el has no effect
2015-10-18 16:48 compile-defun of function in package.el has no effect eric.scott
@ 2015-10-19 11:54 ` Michael Heerdegen
[not found] ` <mailman.630.1445255709.7904.help-gnu-emacs@gnu.org>
2015-10-19 20:25 ` Stefan Monnier
2 siblings, 0 replies; 4+ messages in thread
From: Michael Heerdegen @ 2015-10-19 11:54 UTC (permalink / raw)
To: help-gnu-emacs
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.
^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <mailman.630.1445255709.7904.help-gnu-emacs@gnu.org>]
* Re: compile-defun of function in package.el has no effect
[not found] ` <mailman.630.1445255709.7904.help-gnu-emacs@gnu.org>
@ 2015-10-19 14:21 ` Joost Kremers
0 siblings, 0 replies; 4+ messages in thread
From: Joost Kremers @ 2015-10-19 14:21 UTC (permalink / raw)
To: help-gnu-emacs
Michael Heerdegen wrote:
> eric.scott@acm.org writes:
>> 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.
If it's a defun or some other definition, C-M-x will do as well.
Advantage is that you don't need to put the cursor after the s-expr. It
also works when point is in the middle of the defun.
--
Joost Kremers joostkremers@fastmail.fm
Selbst in die Unterwelt dringt durch Spalten Licht
EN:SiS(9)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: compile-defun of function in package.el has no effect
2015-10-18 16:48 compile-defun of function in package.el has no effect eric.scott
2015-10-19 11:54 ` Michael Heerdegen
[not found] ` <mailman.630.1445255709.7904.help-gnu-emacs@gnu.org>
@ 2015-10-19 20:25 ` Stefan Monnier
2 siblings, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2015-10-19 20:25 UTC (permalink / raw)
To: help-gnu-emacs
> then executed M-x compile-defun on it.
How did you end up deciding to do that?
Hmm... I see it's mentioned in lispref/compile.texi.
It probably requires some updates since eval-defun has seen various
changes over the years, but compile-defun hasn't, even though it does
pretty much the same thing.
> 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'?
If you edited the file in a fresh new Emacs, then used compile-defun and
then tried M-x package-install, it's possible that package.el was not
yet loaded when you did the compile-defun, so it got loaded when you
tried to package-install, and that undid the effect of compile-defun
(loading from the package.elc file rather than the changed package.el).
> BTW, the error I'm getting when trying to install elpy is 'package
> emacs-24.1 is unavailable'. I'm running v 24.3.
There's something really wrong here, then. Have you tried with an empty .emacs?
Stefan
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-10-19 20:25 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-18 16:48 compile-defun of function in package.el has no effect eric.scott
2015-10-19 11:54 ` Michael Heerdegen
[not found] ` <mailman.630.1445255709.7904.help-gnu-emacs@gnu.org>
2015-10-19 14:21 ` Joost Kremers
2015-10-19 20:25 ` Stefan Monnier
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.