Gnus development mailing list
 help / color / mirror / Atom feed
* autoload variables
@ 2006-11-13 11:27 Katsumi Yamaoka
  2006-11-13 19:08 ` Reiner Steib
  0 siblings, 1 reply; 6+ messages in thread
From: Katsumi Yamaoka @ 2006-11-13 11:27 UTC (permalink / raw)


Isn't this funny?

NNTPSERVER=flab; export NNTPSERVER
emacs -batch -Q -eval '(message "%s" (getenv "NNTPSERVER"))'
 => flab
emacs -batch -Q -eval '(message "%s" (gnus-getenv-nntpserver))'
 => flab
emacs -batch -Q -eval '(message "%s" gnus-select-method)'
 => nil

In Emacs, `gnus-getenv-nntpserver' and `gnus-select-method' are
defined in loaddefs.el but it is not loaded when Emacs starts.
I guess the nil value of `gnus-select-method' was set at the
time when I built Emacs.  It suggests that the default value of
`gnus-select-method' is decided according to the Linux
distributions, without minding what is suitable to a user.  I
don't have an idea to fix this except for removing the autoload
cookie.

Regards,

P.S.  XEmacs complains as follows when compiling this autoload:

Compiling gnus/lisp/auto-autoloads.el...
While compiling toplevel forms in file gnus/lisp/auto-autoloads.el:
  ** reference to free variable gnus-default-nntp-server
  ** reference to free variable gnus-nntp-service
Wrote gnus/lisp/auto-autoloads.elc



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

* Re: autoload variables
  2006-11-13 11:27 autoload variables Katsumi Yamaoka
@ 2006-11-13 19:08 ` Reiner Steib
  2006-11-14  1:31   ` Katsumi Yamaoka
  0 siblings, 1 reply; 6+ messages in thread
From: Reiner Steib @ 2006-11-13 19:08 UTC (permalink / raw)


On Mon, Nov 13 2006, Katsumi Yamaoka wrote:

> Isn't this funny?
>
> NNTPSERVER=flab; export NNTPSERVER
> emacs -batch -Q -eval '(message "%s" (getenv "NNTPSERVER"))'
>  => flab
> emacs -batch -Q -eval '(message "%s" (gnus-getenv-nntpserver))'
>  => flab
> emacs -batch -Q -eval '(message "%s" gnus-select-method)'
>  => nil

I always have set NNTPSERVER set, both when building and running Emacs
and I get the same results.

> In Emacs, `gnus-getenv-nntpserver' and `gnus-select-method' are
> defined in loaddefs.el but it is not loaded when Emacs starts.

Isn't loaddefs.el dumped into the binary?

> I guess the nil value of `gnus-select-method' was set at the
> time when I built Emacs.

This is not true according to my observation.

> It suggests that the default value of `gnus-select-method' is
> decided according to the Linux distributions, without minding what
> is suitable to a user.  I don't have an idea to fix this except for
> removing the autoload cookie.

The idea of the autoload for `gnus-select-method' was to make `M-x
customize-variable RET gnus-select-method RET' work without starting
or even loading Gnus.  But maybe my change was incorrect, cf. Nelson
Ferreira's report for XEmacs:
<http://thread.gmane.org/gmane.emacs.gnus.general/63964>.

Here a different approach:

--8<---------------cut here---------------start------------->8---
--- gnus.el	25 Oct 2006 13:30:08 +0200	1.56
+++ gnus.el	13 Nov 2006 18:42:07 +0100	
@@ -1239,7 +1239,6 @@
   :group 'gnus-server
   :type 'file)
 
-;;;###autoload
 (defun gnus-getenv-nntpserver ()
   "Find default nntp server.
 Check the NNTPSERVER environment variable and the
@@ -1251,7 +1250,8 @@
 	     (when (re-search-forward "[^ \t\n\r]+" nil t)
 	       (match-string 0))))))
 
-;;;###autoload
+;;;###autoload(when (fboundp 'custom-autoload) (custom-autoload 'gnus-select-method "gnus"))
+
 (defcustom gnus-select-method
   (condition-case nil
       (nconc
--8<---------------cut here---------------end--------------->8---

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/




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

* Re: autoload variables
  2006-11-13 19:08 ` Reiner Steib
@ 2006-11-14  1:31   ` Katsumi Yamaoka
  2006-11-14  5:43     ` Katsumi Yamaoka
  0 siblings, 1 reply; 6+ messages in thread
From: Katsumi Yamaoka @ 2006-11-14  1:31 UTC (permalink / raw)


>>>>> In <v9lkmf5fm6.fsf@marauder.physik.uni-ulm.de>
>>>>>	Reiner Steib wrote:

>> NNTPSERVER=flab; export NNTPSERVER
>> emacs -batch -Q -eval '(message "%s" (getenv "NNTPSERVER"))'
>>  => flab
>> emacs -batch -Q -eval '(message "%s" (gnus-getenv-nntpserver))'
>>  => flab
>> emacs -batch -Q -eval '(message "%s" gnus-select-method)'
>>  => nil

> I always have set NNTPSERVER set, both when building and running Emacs
> and I get the same results.

I always have not set env vars if there are alternative Lisp
variables that can be set in .emacs file.  But now I realized
the reason `gnus-select-method' defaults to nil is not related
to the value of NNTPSERVER.

>> In Emacs, `gnus-getenv-nntpserver' and `gnus-select-method' are
>> defined in loaddefs.el but it is not loaded when Emacs starts.

> Isn't loaddefs.el dumped into the binary?

Yes, I verified it.  The default value of `gnus-select-method'
is always nil.  I stripped two `condition-case' from the
`gnus-select-method' form in loaddefs.el, removed src/emacs, did
`make', and got the following error:

LC_ALL=C ./temacs -batch -l loadup dump
[...]
Loading loaddefs.el (source)...
Attempt to autoload gnus-getenv-nntpserver while preparing to dump
make[1]: *** [emacs] Error 255

[...]

> The idea of the autoload for `gnus-select-method' was to make `M-x
> customize-variable RET gnus-select-method RET' work without starting
> or even loading Gnus.

I see.  But the present way restrains the intention of the value
form in defcustom, that is, attempting to set a default value
suitable to a user according to NNTPSERVER.

> But maybe my change was incorrect, cf. Nelson
> Ferreira's report for XEmacs:
> <http://thread.gmane.org/gmane.emacs.gnus.general/63964>.

> Here a different approach:

[...]

> +;;;###autoload(when (fboundp 'custom-autoload) (custom-autoload 'gnus-select-method "gnus"))

I tried it and felt that's much better.  It doesn't bound
`gnus-select-method' at the startup but enables a user to do
`customize-variable' without loading Gnus.  Moreover, it offers
a default value which reflects the value of NNTPSERVER.

Regards,



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

* Re: autoload variables
  2006-11-14  1:31   ` Katsumi Yamaoka
@ 2006-11-14  5:43     ` Katsumi Yamaoka
  2006-11-14  7:24       ` Katsumi Yamaoka
  0 siblings, 1 reply; 6+ messages in thread
From: Katsumi Yamaoka @ 2006-11-14  5:43 UTC (permalink / raw)


>>>>> In <b4mac2uddb2.fsf@jpl.org> Katsumi Yamaoka wrote:

>> +;;;###autoload(when (fboundp 'custom-autoload) (custom-autoload 'gnus-select-method "gnus"))

> I tried it and felt that's much better.  It doesn't bound
> `gnus-select-method' at the startup but enables a user to do
> `customize-variable' without loading Gnus.  Moreover, it offers
> a default value which reflects the value of NNTPSERVER.

`custom-autoload' is not available in Emacs 21 and XEmacs 21.4.
I'll look for another way...



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

* Re: autoload variables
  2006-11-14  5:43     ` Katsumi Yamaoka
@ 2006-11-14  7:24       ` Katsumi Yamaoka
  2006-11-14 17:04         ` Reiner Steib
  0 siblings, 1 reply; 6+ messages in thread
From: Katsumi Yamaoka @ 2006-11-14  7:24 UTC (permalink / raw)


>>>>> In <b4my7qe8tww.fsf@jpl.org> Katsumi Yamaoka wrote:

>>> +;;;###autoload(when (fboundp 'custom-autoload) (custom-autoload 'gnus-select-method "gnus"))

[...]

> `custom-autoload' is not available in Emacs 21 and XEmacs 21.4.
> I'll look for another way...

Er, that might be a stupid talk.  `(fboundp 'custom-autoload)'
means that we don't need to mind even if those who use old Emacs
cannot do `customize-variable' before loading Gnus, doesn't it?
If so, could you commit the new autoload?

In addition to this, it seems good to add `custom-autoload' to
lpath.el to silence old Emacsen:

--8<---------------cut here---------------start------------->8---
--- lpath.el~	2006-06-06 06:18:34 +0000
+++ lpath.el	2006-11-14 07:19:44 +0000
@@ -10,7 +10,7 @@
   (mapcar (lambda (var) (unless (boundp var) (set var nil))) args))
 
 (maybe-fbind '(Info-directory
-	       Info-menu create-image display-graphic-p
+	       Info-menu create-image custom-autoload display-graphic-p
 	       display-time-event-handler find-coding-system find-image
 	       image-size image-type-available-p insert-image
 	       make-mode-line-mouse-map make-network-process make-temp-file
--8<---------------cut here---------------end--------------->8---

Regards,



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

* Re: autoload variables
  2006-11-14  7:24       ` Katsumi Yamaoka
@ 2006-11-14 17:04         ` Reiner Steib
  0 siblings, 0 replies; 6+ messages in thread
From: Reiner Steib @ 2006-11-14 17:04 UTC (permalink / raw)


On Tue, Nov 14 2006, Katsumi Yamaoka wrote:

>>>>>> In <b4my7qe8tww.fsf@jpl.org> Katsumi Yamaoka wrote:
>
>>>> +;;;###autoload(when (fboundp 'custom-autoload) (custom-autoload 'gnus-select-method "gnus"))
>
> [...]
>
>> `custom-autoload' is not available in Emacs 21 and XEmacs 21.4.
>> I'll look for another way...
>
> Er, that might be a stupid talk.  `(fboundp 'custom-autoload)'
> means that we don't need to mind even if those who use old Emacs
> cannot do `customize-variable' before loading Gnus, doesn't it?

Yes.  It would be nice if there's a possibility to make it work for
Emacs 21 and XEmacs 21.4 as well.

> If so, could you commit the new autoload?

Done.

> In addition to this, it seems good to add `custom-autoload' to
> lpath.el to silence old Emacsen:
[...]
> -	       Info-menu create-image display-graphic-p
> +	       Info-menu create-image custom-autoload display-graphic-p

Added.

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/




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

end of thread, other threads:[~2006-11-14 17:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-13 11:27 autoload variables Katsumi Yamaoka
2006-11-13 19:08 ` Reiner Steib
2006-11-14  1:31   ` Katsumi Yamaoka
2006-11-14  5:43     ` Katsumi Yamaoka
2006-11-14  7:24       ` Katsumi Yamaoka
2006-11-14 17:04         ` Reiner Steib

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).