Gnus development mailing list
 help / color / mirror / Atom feed
* [PATCH] auth-source.el: Also load EIEIO when byte-compiling.
@ 2011-02-17  1:47 Raphael Kubo da Costa
  2011-02-17  2:59 ` Katsumi Yamaoka
  0 siblings, 1 reply; 8+ messages in thread
From: Raphael Kubo da Costa @ 2011-02-17  1:47 UTC (permalink / raw)
  To: ding; +Cc: tzz

Commit 4a0aa92 moved (require 'eieio) to an `or', and the
byte-compiler only loads top-level `require' calls, which resulted in
problems when the byte-compiler tried to evaluate the `defclass'
macro.

The fallback loading code has also been changed -- there was a single
condition being checked, and if it evaluated to t the `load' call was
always made.
---
 lisp/ChangeLog      |    6 ++++++
 lisp/auth-source.el |   12 ++++++------
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 61538e2..3b17570 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
+2011-02-16  Raphael Kubo da Costa  <kubito@gmail.com>
+
+	* auth-source.el: Correctly load EIEIO from "gnus-fallback-lib/eieio"
+	as EIEIO must also be loaded when auth-source.el is being
+	byte-compiled.
+
 2011-02-16  Teodor Zlatanov  <tzz@lifelogs.com>
 
 	* gnus-fallback-lib/eieio/eieio.el: Copy from Emacs.
diff --git a/lisp/auth-source.el b/lisp/auth-source.el
index abcc85b..3841e58 100644
--- a/lisp/auth-source.el
+++ b/lisp/auth-source.el
@@ -44,12 +44,12 @@
 (require 'netrc)
 (require 'assoc)
 (eval-when-compile (require 'cl))
-(ignore-errors
-  (or (require 'eieio))
-  ;; gnus-fallback-lib/ from gnus/lisp/gnus-fallback-lib
-  (load "gnus-fallback-lib/eieio/eieio"))
-(unless (featurep 'eieio)
-  (error "eieio not found in `load-path' or gnus-fallback-lib/ directory."))
+(eval-and-compile
+  (or (require 'eieio nil t)
+      ;; gnus-fallback-lib/ from gnus/lisp/gnus-fallback-lib
+      (load "gnus-fallback-lib/eieio/eieio"))
+  (unless (featurep 'eieio)
+    (error "eieio not found in `load-path' or gnus-fallback-lib/ directory.")))
 
 (autoload 'secrets-create-item "secrets")
 (autoload 'secrets-delete-item "secrets")
-- 
1.7.3.5




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] auth-source.el: Also load EIEIO when byte-compiling.
  2011-02-17  1:47 [PATCH] auth-source.el: Also load EIEIO when byte-compiling Raphael Kubo da Costa
@ 2011-02-17  2:59 ` Katsumi Yamaoka
  2011-02-17  3:05   ` Raphael Kubo da Costa
  2011-02-17  3:22   ` Ted Zlatanov
  0 siblings, 2 replies; 8+ messages in thread
From: Katsumi Yamaoka @ 2011-02-17  2:59 UTC (permalink / raw)
  To: Raphael Kubo da Costa; +Cc: ding

Raphael Kubo da Costa <kubito@gmail.com> wrote:
> Commit 4a0aa92 moved (require 'eieio) to an `or', and the
> byte-compiler only loads top-level `require' calls, which resulted in
> problems when the byte-compiler tried to evaluate the `defclass'
> macro.

> The fallback loading code has also been changed -- there was a single
> condition being checked, and if it evaluated to t the `load' call was
> always made.

Thanks.  But I still get an error when loading auth-source.elc:

Debugger entered--Lisp error: (void-variable auth-source-backend)
  byte-code("\304^H\305\306\307\310\311\312...

A workaround is to remove auth-source.elc in the installation
directory.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] auth-source.el: Also load EIEIO when byte-compiling.
  2011-02-17  2:59 ` Katsumi Yamaoka
@ 2011-02-17  3:05   ` Raphael Kubo da Costa
  2011-02-17  3:55     ` Katsumi Yamaoka
  2011-02-17  3:22   ` Ted Zlatanov
  1 sibling, 1 reply; 8+ messages in thread
From: Raphael Kubo da Costa @ 2011-02-17  3:05 UTC (permalink / raw)
  To: Katsumi Yamaoka; +Cc: ding

Katsumi Yamaoka <yamaoka@jpl.org> writes:

> Raphael Kubo da Costa <kubito@gmail.com> wrote:
>> Commit 4a0aa92 moved (require 'eieio) to an `or', and the
>> byte-compiler only loads top-level `require' calls, which resulted in
>> problems when the byte-compiler tried to evaluate the `defclass'
>> macro.
>
>> The fallback loading code has also been changed -- there was a single
>> condition being checked, and if it evaluated to t the `load' call was
>> always made.
>
> Thanks.  But I still get an error when loading auth-source.elc:
>
> Debugger entered--Lisp error: (void-variable auth-source-backend)
>   byte-code("\304^H\305\306\307\310\311\312...
>
> A workaround is to remove auth-source.elc in the installation
> directory.

Weird, that is what I was getting before the commit. I'm on GNU Emacs
23.2.1 here.

Does it still happen if you run 'git clean -fdx && ./configure && make'?
Before the patch, make would show a lot of warnings related to
`defclass' not being defined when it was called in auth-source.el and it
was being byte-compiled. After the patch, the warnings disappear and I
can call (require 'auth-source) in the scratchb buffer without getting
the void-variable errors.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] auth-source.el: Also load EIEIO when byte-compiling.
  2011-02-17  2:59 ` Katsumi Yamaoka
  2011-02-17  3:05   ` Raphael Kubo da Costa
@ 2011-02-17  3:22   ` Ted Zlatanov
  1 sibling, 0 replies; 8+ messages in thread
From: Ted Zlatanov @ 2011-02-17  3:22 UTC (permalink / raw)
  To: ding

On Thu, 17 Feb 2011 11:59:12 +0900 Katsumi Yamaoka <yamaoka@jpl.org> wrote: 

KY> Raphael Kubo da Costa <kubito@gmail.com> wrote:
>> Commit 4a0aa92 moved (require 'eieio) to an `or', and the
>> byte-compiler only loads top-level `require' calls, which resulted in
>> problems when the byte-compiler tried to evaluate the `defclass'
>> macro.

>> The fallback loading code has also been changed -- there was a single
>> condition being checked, and if it evaluated to t the `load' call was
>> always made.

KY> Thanks.  But I still get an error when loading auth-source.elc:

KY> Debugger entered--Lisp error: (void-variable auth-source-backend)
KY>   byte-code("\304^H\305\306\307\310\311\312...

KY> A workaround is to remove auth-source.elc in the installation
KY> directory.

It works for me, but I did "make clean".  Do you mean people will get
that Lisp error randomly?  Or when they don't do "make clean"?  I don't
know dgnushack.el or much of the byte-compilation arcana, so any help is
greatly appreciated.

Raphael, thanks for the patch.  I was in a hurry and didn't look carefully.

Ted




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] auth-source.el: Also load EIEIO when byte-compiling.
  2011-02-17  3:05   ` Raphael Kubo da Costa
@ 2011-02-17  3:55     ` Katsumi Yamaoka
  2011-02-17  4:34       ` Raphael Kubo da Costa
  0 siblings, 1 reply; 8+ messages in thread
From: Katsumi Yamaoka @ 2011-02-17  3:55 UTC (permalink / raw)
  To: ding

Raphael Kubo da Costa <kubito@gmail.com> wrote:
>> Thanks.  But I still get an error when loading auth-source.elc:
> Weird, that is what I was getting before the commit. I'm on GNU Emacs
> 23.2.1 here.

I may have done something wrong.  Sorry.

I've changed the way to load eieio in the git repo since it fails
in loading eieio-comp, that eieio requires, when compiling with
Emacs 23.1 and earlier:

Loading gnus/lisp/gnus-fallback-lib/eieio/eieio.el (source)...
In toplevel form:
auth-source.el:47:1:Error: Cannot open load file: eieio-comp



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] auth-source.el: Also load EIEIO when byte-compiling.
  2011-02-17  3:55     ` Katsumi Yamaoka
@ 2011-02-17  4:34       ` Raphael Kubo da Costa
  2011-02-17  5:00         ` Katsumi Yamaoka
  0 siblings, 1 reply; 8+ messages in thread
From: Raphael Kubo da Costa @ 2011-02-17  4:34 UTC (permalink / raw)
  To: ding

Katsumi Yamaoka <yamaoka@jpl.org> writes:

> I've changed the way to load eieio in the git repo since it fails
> in loading eieio-comp, that eieio requires, when compiling with
> Emacs 23.1 and earlier:
>
> Loading gnus/lisp/gnus-fallback-lib/eieio/eieio.el (source)...
> In toplevel form:
> auth-source.el:47:1:Error: Cannot open load file: eieio-comp

Hmm, perhaps gnus-fallback-lib/eieio must be added to load-path then? My
guess is that the `load' call works because the whole path relative to
lisp/ (which is in the load-path) is specified, and when eieio.el tries
to load the other files in its directory they cannot be found, since
gnus-fallback-lib/eieio is not in load-path.

A possible quick'n'dirty patch is this one:

diff --git a/lisp/auth-source.el b/lisp/auth-source.el
index 3841e58..855ee6f 100644
--- a/lisp/auth-source.el
+++ b/lisp/auth-source.el
@@ -45,9 +45,10 @@
 (require 'assoc)
 (eval-when-compile (require 'cl))
 (eval-and-compile
-  (or (require 'eieio nil t)
-      ;; gnus-fallback-lib/ from gnus/lisp/gnus-fallback-lib
-      (load "gnus-fallback-lib/eieio/eieio"))
+  (unless (require 'eieio nil t)
+    ;; gnus-fallback-lib/ from gnus/lisp/gnus-fallback-lib
+    (push (expand-file-name "./gnus-fallback-lib/eieio/eieio") load-path)
+    (require 'eieio nil t))
   (unless (featurep 'eieio)
     (error "eieio not found in `load-path' or gnus-fallback-lib/ directory.")))




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] auth-source.el: Also load EIEIO when byte-compiling.
  2011-02-17  4:34       ` Raphael Kubo da Costa
@ 2011-02-17  5:00         ` Katsumi Yamaoka
  2011-02-17 17:02           ` Ted Zlatanov
  0 siblings, 1 reply; 8+ messages in thread
From: Katsumi Yamaoka @ 2011-02-17  5:00 UTC (permalink / raw)
  To: ding

Raphael Kubo da Costa <kubito@gmail.com> wrote:
[...]
> +  (unless (require 'eieio nil t)
> +    ;; gnus-fallback-lib/ from gnus/lisp/gnus-fallback-lib
> +    (push (expand-file-name "./gnus-fallback-lib/eieio/eieio") load-path)
> +    (require 'eieio nil t))

"./" is not necessarily the Gnus installation directory.
My alternative dirty one is in the git repo. ;-)



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] auth-source.el: Also load EIEIO when byte-compiling.
  2011-02-17  5:00         ` Katsumi Yamaoka
@ 2011-02-17 17:02           ` Ted Zlatanov
  0 siblings, 0 replies; 8+ messages in thread
From: Ted Zlatanov @ 2011-02-17 17:02 UTC (permalink / raw)
  To: ding

On Thu, 17 Feb 2011 14:00:22 +0900 Katsumi Yamaoka <yamaoka@jpl.org> wrote: 

KY> Raphael Kubo da Costa <kubito@gmail.com> wrote:
KY> [...]
>> +  (unless (require 'eieio nil t)
>> +    ;; gnus-fallback-lib/ from gnus/lisp/gnus-fallback-lib
>> +    (push (expand-file-name "./gnus-fallback-lib/eieio/eieio") load-path)
>> +    (require 'eieio nil t))

KY> "./" is not necessarily the Gnus installation directory.
KY> My alternative dirty one is in the git repo. ;-)

Thank you for fixing that!  It seems to work for me.

Ted




^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-02-17 17:02 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-17  1:47 [PATCH] auth-source.el: Also load EIEIO when byte-compiling Raphael Kubo da Costa
2011-02-17  2:59 ` Katsumi Yamaoka
2011-02-17  3:05   ` Raphael Kubo da Costa
2011-02-17  3:55     ` Katsumi Yamaoka
2011-02-17  4:34       ` Raphael Kubo da Costa
2011-02-17  5:00         ` Katsumi Yamaoka
2011-02-17 17:02           ` Ted Zlatanov
2011-02-17  3:22   ` Ted Zlatanov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).