unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* elisp how to return directly from a function
@ 2006-06-30 10:50 lalit mohan tripathi
  0 siblings, 0 replies; 3+ messages in thread
From: lalit mohan tripathi @ 2006-06-30 10:50 UTC (permalink / raw)



[-- Attachment #1.1: Type: text/plain, Size: 409 bytes --]

Hi Everyone,

    Could anyone explain me how I can directly return from a defun in elisp.

    basically I have following type of code:

    ......... body of defun ............
    ..........................................
    (if condition01
            (return 10)  ; return from this defun with value 10
         t)

    .......... rest body of defun ....
   ...........................................

[-- Attachment #1.2: Type: text/html, Size: 812 bytes --]

[-- Attachment #2: Type: text/plain, Size: 152 bytes --]

_______________________________________________
help-gnu-emacs mailing list
help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

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

* Re: elisp how to return directly from a function
       [not found] <mailman.3559.1151664608.9609.help-gnu-emacs@gnu.org>
@ 2006-06-30 11:06 ` David Kastrup
  2006-06-30 15:08 ` Pascal Bourguignon
  1 sibling, 0 replies; 3+ messages in thread
From: David Kastrup @ 2006-06-30 11:06 UTC (permalink / raw)


"lalit mohan tripathi" <lalit.tripathi@gmail.com> writes:

> Hi Everyone,
>  
>     Could anyone explain me how I can directly return from a defun in elisp.
>  
>     basically I have following type of code:
>  
>     ......... body of defun ............
>     ..........................................
>     (if condition01
>             (return 10)  ; return from this defun with value 10
>          t)
>   
>     .......... rest body of defun ....
>    ...........................................

If you really must:

(defun whatever ()
  (catch 'return
    (... body of defun ...
       (if condition01
           (throw 'return 10))
       ... rest body of defun ...
)))

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

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

* Re: elisp how to return directly from a function
       [not found] <mailman.3559.1151664608.9609.help-gnu-emacs@gnu.org>
  2006-06-30 11:06 ` elisp how to return directly from a function David Kastrup
@ 2006-06-30 15:08 ` Pascal Bourguignon
  1 sibling, 0 replies; 3+ messages in thread
From: Pascal Bourguignon @ 2006-06-30 15:08 UTC (permalink / raw)


"lalit mohan tripathi" <lalit.tripathi@gmail.com> writes:

> Hi Everyone,
> Could anyone explain me how I can directly return from a defun in elisp.

(require 'cl)

(defun* fun ()
  ...
  (return-from fun 10)
  ...)


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

"You question the worthiness of my code? I should kill you where you
stand!"

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

end of thread, other threads:[~2006-06-30 15:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.3559.1151664608.9609.help-gnu-emacs@gnu.org>
2006-06-30 11:06 ` elisp how to return directly from a function David Kastrup
2006-06-30 15:08 ` Pascal Bourguignon
2006-06-30 10:50 lalit mohan tripathi

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 read-only IMAP folder(s) and NNTP newsgroup(s).