Gnus development mailing list
 help / color / mirror / Atom feed
* `gnus-bound-and-true-p'
       [not found] <E1RLEn8-0001hI-O3@quimby.gnus.org>
@ 2011-11-02 20:53 ` Reiner Steib
  2011-11-02 21:09   ` `gnus-bound-and-true-p' Robert Pluim
  0 siblings, 1 reply; 5+ messages in thread
From: Reiner Steib @ 2011-11-02 20:53 UTC (permalink / raw)
  To: ding

On Tue, Nov 01 2011, Ted Zlatanov wrote:
> -(eval-when-compile
> -  ;; This is unnecessary in the compiled version as it is a macro.
> -  (if (fboundp 'bound-and-true-p)
> -      (defalias 'gnus-bound-and-true-p 'bound-and-true-p)
> -    (defmacro gnus-bound-and-true-p (var)
> -      "Return the value of symbol VAR if it is bound, else nil."
> -      `(and (boundp (quote ,var)) ,var))))
> -
> -(defun gnus-bound-and-true-dumber-p (sym)
> +;; simple check, can be a macro but this way, although slow, it's really clear
> +(defun gnus-bound-and-true-p (sym)
>    (and (boundp sym) (symbol-value sym)))

On Wed, Nov 02 2011, Ted Zlatanov wrote:
> -;; simple check, can be a macro but this way, although slow, it's really clear
> +;; Simple check: can be a macro but this way, although slow, it's really clear.
> +;; We don't use `bound-and-true-p' because it's not in XEmacs.
>  (defun gnus-bound-and-true-p (sym)
>    (and (boundp sym) (symbol-value sym)))

Can't you use an alias for Emacs and a macro for XEmacs?

(if (fboundp 'bound-and-true-p)
    (defalias 'gnus-bound-and-true-p 'bound-and-true-p)
  (defmacro gnus-bound-and-true-p (var)
    "Return the value of symbol VAR if it is bound, else nil."
    `(and (boundp (quote ,var)) ,var)))

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




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

* Re: `gnus-bound-and-true-p'
  2011-11-02 20:53 ` `gnus-bound-and-true-p' Reiner Steib
@ 2011-11-02 21:09   ` Robert Pluim
  2011-11-02 21:55     ` `gnus-bound-and-true-p' Ted Zlatanov
  0 siblings, 1 reply; 5+ messages in thread
From: Robert Pluim @ 2011-11-02 21:09 UTC (permalink / raw)
  To: ding

Reiner Steib <reinersteib+gmane@imap.cc> writes:

> On Tue, Nov 01 2011, Ted Zlatanov wrote:
>> -(eval-when-compile
>> -  ;; This is unnecessary in the compiled version as it is a macro.
>> -  (if (fboundp 'bound-and-true-p)
>> -      (defalias 'gnus-bound-and-true-p 'bound-and-true-p)
>> -    (defmacro gnus-bound-and-true-p (var)
>> -      "Return the value of symbol VAR if it is bound, else nil."
>> -      `(and (boundp (quote ,var)) ,var))))
>> -
>> -(defun gnus-bound-and-true-dumber-p (sym)
>> +;; simple check, can be a macro but this way, although slow, it's really clear
>> +(defun gnus-bound-and-true-p (sym)
>>    (and (boundp sym) (symbol-value sym)))
>
> On Wed, Nov 02 2011, Ted Zlatanov wrote:
>> -;; simple check, can be a macro but this way, although slow, it's really clear
>> +;; Simple check: can be a macro but this way, although slow, it's really clear.
>> +;; We don't use `bound-and-true-p' because it's not in XEmacs.
>>  (defun gnus-bound-and-true-p (sym)
>>    (and (boundp sym) (symbol-value sym)))
>
> Can't you use an alias for Emacs and a macro for XEmacs?
>
> (if (fboundp 'bound-and-true-p)
>     (defalias 'gnus-bound-and-true-p 'bound-and-true-p)
>   (defmacro gnus-bound-and-true-p (var)
>     "Return the value of symbol VAR if it is bound, else nil."
>     `(and (boundp (quote ,var)) ,var)))

Especially since in XEmacs 21.5:

`bound-and-true-p' is a compiled Lisp macro
  -- loaded from "/build/xemacs-edge/lisp/subr.elc"
(bound-and-true-p VAR)

Documentation:
Return the value of symbol VAR if it is bound, else nil.

And:

(fboundp 'bound-and-true-p) => t

Robert




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

* Re: `gnus-bound-and-true-p'
  2011-11-02 21:09   ` `gnus-bound-and-true-p' Robert Pluim
@ 2011-11-02 21:55     ` Ted Zlatanov
  2011-11-02 22:48       ` `gnus-bound-and-true-p' Dave Abrahams
  0 siblings, 1 reply; 5+ messages in thread
From: Ted Zlatanov @ 2011-11-02 21:55 UTC (permalink / raw)
  To: ding

On Wed, 02 Nov 2011 22:09:32 +0100 Robert Pluim <rpluim@gmail.com> wrote: 

RP> Reiner Steib <reinersteib+gmane@imap.cc> writes:

>> Can't you use an alias for Emacs and a macro for XEmacs?
>> 
>> (if (fboundp 'bound-and-true-p)
>> (defalias 'gnus-bound-and-true-p 'bound-and-true-p)
>> (defmacro gnus-bound-and-true-p (var)
>> "Return the value of symbol VAR if it is bound, else nil."
>> `(and (boundp (quote ,var)) ,var)))

That was failing in XEmacs according to the Gnus Buildbot.  See
http://www.randomsample.de:4456/grid, older builds.  It may have been
the `eval-when-compile'.

RP> Especially since in XEmacs 21.5:

RP> `bound-and-true-p' is a compiled Lisp macro
RP>   -- loaded from "/build/xemacs-edge/lisp/subr.elc"
RP> (bound-and-true-p VAR)

RP> Documentation:
RP> Return the value of symbol VAR if it is bound, else nil.

RP> And:

RP> (fboundp 'bound-and-true-p) => t

I've spend too many hours dealing with this issue.  So if you guys or
anyone else can provide a patch that works in Emacs and XEmacs, please
do and let's be done.  Please keep in mind this is used very rarely, so
not using a macro works perfectly well as far as performance, but I
agree that it's nice to rely on the built-in functionality.

Thanks
Ted




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

* Re: `gnus-bound-and-true-p'
  2011-11-02 21:55     ` `gnus-bound-and-true-p' Ted Zlatanov
@ 2011-11-02 22:48       ` Dave Abrahams
  2011-11-02 23:51         ` `gnus-bound-and-true-p' Ted Zlatanov
  0 siblings, 1 reply; 5+ messages in thread
From: Dave Abrahams @ 2011-11-02 22:48 UTC (permalink / raw)
  To: ding; +Cc: Ted Zlatanov


on Wed Nov 02 2011, Ted Zlatanov <tzz-AT-lifelogs.com> wrote:

> I've spend too many hours dealing with this issue.  So if you guys or
> anyone else can provide a patch that works in Emacs and XEmacs, please
> do and let's be done.  Please keep in mind this is used very rarely, so
> not using a macro works perfectly well as far as performance, but I
> agree that it's nice to rely on the built-in functionality.

I'm sorry, but I think all this focus on bound-and-true-p is
misdirected.  IIUC, the fix for the problem is in this patch:

  http://lists.gnu.org/archive/html/emacs-devel/2011-11/msg00000.html

I simply didn't realize that (defvar <symbol>) would leave <symbol>
unbound.

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com




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

* Re: `gnus-bound-and-true-p'
  2011-11-02 22:48       ` `gnus-bound-and-true-p' Dave Abrahams
@ 2011-11-02 23:51         ` Ted Zlatanov
  0 siblings, 0 replies; 5+ messages in thread
From: Ted Zlatanov @ 2011-11-02 23:51 UTC (permalink / raw)
  To: ding

On Wed, 02 Nov 2011 14:48:16 -0800 Dave Abrahams <dave@boostpro.com> wrote: 

DA> on Wed Nov 02 2011, Ted Zlatanov <tzz-AT-lifelogs.com> wrote:

>> I've spend too many hours dealing with this issue.  So if you guys or
>> anyone else can provide a patch that works in Emacs and XEmacs, please
>> do and let's be done.  Please keep in mind this is used very rarely, so
>> not using a macro works perfectly well as far as performance, but I
>> agree that it's nice to rely on the built-in functionality.

DA> I'm sorry, but I think all this focus on bound-and-true-p is
DA> misdirected.  IIUC, the fix for the problem is in this patch:

DA>   http://lists.gnu.org/archive/html/emacs-devel/2011-11/msg00000.html

DA> I simply didn't realize that (defvar <symbol>) would leave <symbol>
DA> unbound.

The macro was failing on XEmacs even after I fixed the defvar, according
to the Buildbot.  That's why I got rid of it.  So I don't think it was
your fault :)

Ted




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

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

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <E1RLEn8-0001hI-O3@quimby.gnus.org>
2011-11-02 20:53 ` `gnus-bound-and-true-p' Reiner Steib
2011-11-02 21:09   ` `gnus-bound-and-true-p' Robert Pluim
2011-11-02 21:55     ` `gnus-bound-and-true-p' Ted Zlatanov
2011-11-02 22:48       ` `gnus-bound-and-true-p' Dave Abrahams
2011-11-02 23:51         ` `gnus-bound-and-true-p' 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).