Exiting quietly?

pkirill

Usenet Archive
Joined
Jul 3, 2003
Messages
83
Reaction score
0
I'm having a brain cramp and I can't seem to get this routine to 'exit quietly'. When the user chooses not to "Select Again", I'd like the routine to just stop. Instead, it just continues on unless I put in an (exit) which returns an "error: quit / exit abort". My attempt is below... Any help would be greatly appreciated!

(setq ANOTHER (getkword "Select again? <Y>/N:"))
(if (/= (strcase ANOTHER) "N")
(choose_type)
(quiet_exit)
)

(defun quiet_exit
(princ "\nThis is me exiting quietly\n")
(exit)
(princ)
)
 
Is restructuring your function logic to not use the (exit) function possible?
 
Umm... Probably? I hate the (exit) function, but have been using it for years because I don't know a better way... Or if I did know a better way, I have forgotten it.
 
Yeah I hate it too. I try to structure my routines and functions to not use it. I'm sure with the newer vla- activex stuff I could get streamline my code even better, but I'm still an old lisper that hasn't had time to learn the new stuff yet.
 
Something like this?

(defun C:DOIT (/ ANOTHER)
(setq ANOTHER "Y)
(while (= (strcase ANOTHER) "Y")
(choose_type)
(setq ANOTHER (getkword "Select again? <Y>/N:"))
)
)
 
Many of my routines are set up with a (while. . .) that assumes the user wants to continue until he hits Enter.

(while
(setq something (entsel))
. . .
)

Then the user doesn't have to keep answering a prompt. And you don't have to Exit, you can flip down to the closing (princ), producing a suave and graceful exit.

RS
 
Try

(vl-exit-with-value 1)

This is meant to return a value
to the calling function if you ever need that,
but it does also exit very quietly.
 
I use (vl-exit-with-value (princ))

"Jorge Jimenez"
|>Try
|>
|>(vl-exit-with-value 1)
|>
|>This is meant to return a value
|>to the calling function if you ever need that,
|>but it does also exit very quietly.

James Maeding
Civil Engineer/Programmer
 
James, there is no need to do that.
It's the same thing as doing

(vl-exit-with-value nil)

No matter what value you use,
it won´t echo to the command line
which is the topic here.
 
understood

"Jorge Jimenez"
|>Try
|>
|>(vl-exit-with-value 1)
|>
|>This is meant to return a value
|>to the calling function if you ever need that,
|>but it does also exit very quietly.

James Maeding
Civil Engineer/Programmer
 
Worked like a charm... Thanks!

Jorge Jimenez said:
James, there is no need to do that.
It's the same thing as doing

(vl-exit-with-value nil)

No matter what value you use,
it won´t echo to the command line
which is the topic here.
 

Latest threads

Back
Top