unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Indentation of cond forms in (Emacs) Lisp mode
@ 2014-06-03 13:37 Bozhidar Batsov
  2014-06-03 14:22 ` Andreas Schwab
  0 siblings, 1 reply; 5+ messages in thread
From: Bozhidar Batsov @ 2014-06-03 13:37 UTC (permalink / raw)
  To: emacs-devel

I noticed that `cond' forms in Emacs Lisp mode and Lisp mode are 
indented with just one space, unlike most other "control" structures:

(cond
  ((x) (y))
  (t (z))

Why is that? Seems odd to treat the differently from the likes of `when' 
for instance:

(when something
   (do-something))

I'm asking because this leaked into clojure-mode as well and we're now 
discussing whether it's a bug or something reasonable.

Cheers,
Bozhidar



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

* Re: Indentation of cond forms in (Emacs) Lisp mode
  2014-06-03 13:37 Indentation of cond forms in (Emacs) Lisp mode Bozhidar Batsov
@ 2014-06-03 14:22 ` Andreas Schwab
  2014-06-05  7:07   ` Bozhidar Batsov
  0 siblings, 1 reply; 5+ messages in thread
From: Andreas Schwab @ 2014-06-03 14:22 UTC (permalink / raw)
  To: Bozhidar Batsov; +Cc: emacs-devel

"Bozhidar Batsov" <bozhidar.batsov@gmail.com> writes:

> I noticed that `cond' forms in Emacs Lisp mode and Lisp mode are indented
> with just one space, unlike most other "control" structures:
>
> (cond
>  ((x) (y))
>  (t (z))
>
> Why is that?

The intention is that you do not break after cond, so it isn't treated
specially, ie. like a normal function call.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."



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

* Re: Indentation of cond forms in (Emacs) Lisp mode
  2014-06-03 14:22 ` Andreas Schwab
@ 2014-06-05  7:07   ` Bozhidar Batsov
  2014-06-05  7:37     ` Andreas Schwab
  2014-06-05 13:34     ` Stefan Monnier
  0 siblings, 2 replies; 5+ messages in thread
From: Bozhidar Batsov @ 2014-06-05  7:07 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: emacs-devel

On 3 Jun 2014, at 17:22, Andreas Schwab wrote:

> "Bozhidar Batsov" <bozhidar.batsov@gmail.com> writes:
>
>> I noticed that `cond' forms in Emacs Lisp mode and Lisp mode are 
>> indented
>> with just one space, unlike most other "control" structures:
>>
>> (cond
>> ((x) (y))
>> (t (z))
>>
>> Why is that?
>
> The intention is that you do not break after cond, so it isn't treated
> specially, ie. like a normal function call.
>
> Andreas.

Still, it seems a bit arbitrary. Are there are constructs treated in the 
same manner?

Also, how is this any different from a macro like `with-temp-buffer`, 
which has regular indentation (2 spaces)?

(with-temp-buffer
   (do-something)
   (do-something-else))

>
> -- 
> Andreas Schwab, SUSE Labs, schwab@suse.de
> GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA 
> B9D7
> "And now for something completely different."



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

* Re: Indentation of cond forms in (Emacs) Lisp mode
  2014-06-05  7:07   ` Bozhidar Batsov
@ 2014-06-05  7:37     ` Andreas Schwab
  2014-06-05 13:34     ` Stefan Monnier
  1 sibling, 0 replies; 5+ messages in thread
From: Andreas Schwab @ 2014-06-05  7:37 UTC (permalink / raw)
  To: Bozhidar Batsov; +Cc: emacs-devel

"Bozhidar Batsov" <bozhidar.batsov@gmail.com> writes:

> Also, how is this any different from a macro like `with-temp-buffer`,
> which has regular indentation (2 spaces)?

This matches the generic pattern of (with-foo [sexp] [body]...), which
is intented to be broken before [body].

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."



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

* Re: Indentation of cond forms in (Emacs) Lisp mode
  2014-06-05  7:07   ` Bozhidar Batsov
  2014-06-05  7:37     ` Andreas Schwab
@ 2014-06-05 13:34     ` Stefan Monnier
  1 sibling, 0 replies; 5+ messages in thread
From: Stefan Monnier @ 2014-06-05 13:34 UTC (permalink / raw)
  To: Bozhidar Batsov; +Cc: Andreas Schwab, emacs-devel

>> The intention is that you do not break after cond, so it isn't treated
>> specially, ie. like a normal function call.
> Still, it seems a bit arbitrary.

Yes.  I don't think you'll find a much better answer.


        Stefan



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

end of thread, other threads:[~2014-06-05 13:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-03 13:37 Indentation of cond forms in (Emacs) Lisp mode Bozhidar Batsov
2014-06-03 14:22 ` Andreas Schwab
2014-06-05  7:07   ` Bozhidar Batsov
2014-06-05  7:37     ` Andreas Schwab
2014-06-05 13:34     ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).