all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* (progn (top-level) A B C)
@ 2007-02-14 15:38 A Soare
  2007-02-14 16:38 ` Lennart Borgman (gmail)
  0 siblings, 1 reply; 5+ messages in thread
From: A Soare @ 2007-02-14 15:38 UTC (permalink / raw)
  To: Emacs   Help  [help-gnu-emacs]

Hello,

Can somebody tell me how you write a code to execute the followiung commands in the order t-l A B C:

(top-level)
(A ...)
(B ...)
(C ...) ?


Thanks.

Alin Soare

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

* Re: (progn (top-level) A B C)
       [not found] <mailman.4495.1171467492.2155.help-gnu-emacs@gnu.org>
@ 2007-02-14 16:22 ` Pascal Bourguignon
  0 siblings, 0 replies; 5+ messages in thread
From: Pascal Bourguignon @ 2007-02-14 16:22 UTC (permalink / raw)
  To: help-gnu-emacs

A Soare <alinsoar@voila.fr> writes:

> Hello,
>
> Can somebody tell me how you write a code to execute the followiung commands in the order t-l A B C:
>
> (top-level)
> (A ...)
> (B ...)
> (C ...) ?

(progn
  (top-level)
  (A ...)
  (B ...)
  (C ...))
 

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

CAUTION: The mass of this product contains the energy equivalent of
85 million tons of TNT per net ounce of weight.

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

* Re: (progn (top-level) A B C)
  2007-02-14 15:38 A Soare
@ 2007-02-14 16:38 ` Lennart Borgman (gmail)
  0 siblings, 0 replies; 5+ messages in thread
From: Lennart Borgman (gmail) @ 2007-02-14 16:38 UTC (permalink / raw)
  To: alinsoar; +Cc: Emacs Help [help-gnu-emacs]

A Soare wrote:
> Hello,
> 
> Can somebody tell me how you write a code to execute the followiung commands in the order t-l A B C:
> 
> (top-level)
> (A ...)
> (B ...)
> (C ...) ?


I do not think you can do it directly, but maybe you can use a timer?

(run-with-idle-timer 0 nil (lambda()
                              (message "a")(sit-for 1)
                              (message "b")(sit-for 1)
                              (message "c")(sit-for 1)
                              ))
(top-level)

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

* Re: (progn (top-level) A B C)
@ 2007-02-14 17:37 A Soare
  2007-02-14 17:48 ` Andreas Schwab
  0 siblings, 1 reply; 5+ messages in thread
From: A Soare @ 2007-02-14 17:37 UTC (permalink / raw)
  To: Lennart Borgman (gmail)
  Cc: Emacs   Help  [help-gnu-emacs], Emacs   Bug  [bug-gnu-emacs]


> I do not think you can do it directly, but maybe you can use a timer?
> 
> (run-with-idle-timer 0 nil (lambda()

Thanks, I will check. Another method that I found is

(unwind-protect
    (prog1
        (message "x")
      (top-level))
  (message "a")
  (message "b"))


By the way, this code returns "Back to top level." . BAD.

x
a
b
Back to top level.

What is the definition of prog1? It should return the first argument. It seems that in this case the 1st argument is lost.

This is a BUG in prog1... I think that prog2, progn give the same bug... That is?


Does somebody else knows another methods? Let us make all of you that know a list of methods here for this problem, please...


Trying to solve a bug in the E debugger I asked myself this problem...

Alin Soare.



> Message du 14/02/07 à 17h38
> De : "Lennart Borgman (gmail)" <lennart.borgman@gmail.com>
> A : alinsoar@voila.fr
> Copie à : "Emacs Help [help-gnu-emacs]" <help-gnu-emacs@gnu.org>
> Objet : Re: (progn (top-level) A B C)
> 
> A Soare wrote:
> > Hello,
> > 
> > Can somebody tell me how you write a code to execute the followiung commands in the order t-l A B C:
> > 
> > (top-level)
> > (A ...)
> > (B ...)
> > (C ...) ?
> 
> 
> I do not think you can do it directly, but maybe you can use a timer?
> 
> (run-with-idle-timer 0 nil (lambda()
>                               (message "a")(sit-for 1)
>                               (message "b")(sit-for 1)
>                               (message "c")(sit-for 1)
>                               ))
> (top-level)
> 
>

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

* Re: (progn (top-level) A B C)
  2007-02-14 17:37 (progn (top-level) A B C) A Soare
@ 2007-02-14 17:48 ` Andreas Schwab
  0 siblings, 0 replies; 5+ messages in thread
From: Andreas Schwab @ 2007-02-14 17:48 UTC (permalink / raw)
  To: alinsoar
  Cc: Emacs Help [help-gnu-emacs], Lennart Borgman (gmail),
	Emacs Bug [bug-gnu-emacs]

A Soare <alinsoar@voila.fr> writes:

> Thanks, I will check. Another method that I found is
>
> (unwind-protect
>     (prog1
>         (message "x")
>       (top-level))
>   (message "a")
>   (message "b"))
>
>
> By the way, this code returns "Back to top level." . BAD.

It does not return anything.

> x
> a
> b
> Back to top level.
>
> What is the definition of prog1? It should return the first argument. It seems that in this case the 1st argument is lost.

This is not a bug. (top-level) throws to 'top-level, thus (prog1 ...) is
never finished.  unwind-protect only returns a value if the body completes
normally.  Otherwise it does not return anything, rather execution is
transferred directly to the receiving exception handler after executing
the unwind forms.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

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

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-02-14 17:37 (progn (top-level) A B C) A Soare
2007-02-14 17:48 ` Andreas Schwab
     [not found] <mailman.4495.1171467492.2155.help-gnu-emacs@gnu.org>
2007-02-14 16:22 ` Pascal Bourguignon
  -- strict thread matches above, loose matches on Subject: below --
2007-02-14 15:38 A Soare
2007-02-14 16:38 ` Lennart Borgman (gmail)

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.