Sujet : Re: Which code style do you prefer the most?
De : ldo (at) *nospam* nz.invalid (Lawrence D'Oliveiro)
Groupes : comp.lang.cDate : 06. Mar 2025, 03:34:30
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vqb1jm$2mem7$3@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11 12
User-Agent : Pan/0.162 (Pokrosvk)
On Wed, 5 Mar 2025 09:58:45 +0100, Janis Papanagnou wrote:
With my first glimpse of lithp code I immediately felt repelled ...
I suspect at least part of that is down to the traditional code
layout, where an accumulation of opening parentheses from various
prior lines are all closed at once on a single line. I call this the
“parenthesis pileup” layout.
Here’s a sample of how I prefer to layout my Lisp code:
(global-set-key [?\s-o]
(lambda ()
"open a file named in the region if there is one, else prompt for a file name."
(interactive)
(cond
((use-region-p)
(let (beg end)
(get-cur-line nil beg end)
(find-file (buffer-substring beg end))
) ; let
)
(t
(call-interactively 'find-file)
)
) ; cond
) ; lambda
) ; global-set-key