Discussion:
Elisp syntax - block of commands
(too old to reply)
Benny Simonsen
18 years ago
Permalink
Hey

I have a simple question,

I want to execute two commands if an if evaluates to true:

(if (equal "1" "1")
{
(true_comand 1)
(true_command 2)
}
(false_command)
)

But the {} don't give a "block".
How is it done in elisp?

/Benny
Mark Harrison
18 years ago
Permalink
Post by Benny Simonsen
Hey
I have a simple question,
(if (equal "1" "1")
{
(true_comand 1)
(true_command 2)
}
(false_command)
)
But the {} don't give a "block".
How is it done in elisp?
/Benny
Use progn:

(if (equal "1" "1")
(progn (true-command-1)
(true-command-2))
(false-command))
steve gonedes
4 years ago
Permalink
Post by Benny Simonsen
Hey
I have a simple question,
(if (equal "1" "1")
{
(true_comand 1)
(true_command 2)
}
(false_command)
)
But the {} don't give a "block".
How is it done in elisp?
/Benny
a more complex form is called COND.

(cond ((equal "1" "1")
(true-command x)
(true-command2 x))
(t
(false-command)))

Continue reading on narkive:
Search results for 'Elisp syntax - block of commands' (Questions and Answers)
9
replies
What is the best free program editor out?
started 18 years ago
programming & design
Loading...