I am making an interactive function and encountering a difficulty on the placing of the command list
to set the function argument.
This code
(interactive
(list
(let ( (rqmatch t) (initpk "mixed") (dflt "extended")
(cseq '("expression" "mixed" "hlsexp"
"bracemk" "extended" "disable")) )
(+ 2 2)
(completing-read "Flare_type: " cseq nil rqmatch initpk
'flare-hist dflt))))
versus the following
(interactive
(let ( (rqmatch t) (initpk "mixed") (dflt "extended")
(cseq '("expression" "mixed" "hlsexp"
"bracemk" "extended" "disable")) )
(+ 2 2)
(list
(completing-read "Flare_type: " cseq nil rqmatch initpk
'flare-hist dflt))))
let
at all (but you might have a good argument for it). Also, I am not sure if the formatting that you use here is also the formatting that you use 'in production'. In that case, I would recommend having a look at some 'random' Emacs lisp source files to see the 'common way for formatting'. – dalanicolai Jul 15 '22 at 12:07let
was just a test for cases where they would be required. Emacs source files show a variety of implementations. So there is really no common way. Although we can agree on what makes it easier for working with other people's code. – Dilna Jul 15 '22 at 12:28let
clause is the part that returns values from expressions, which are then collected in a list to set the argument values. – Dilna Jul 15 '22 at 12:32let
clause its body is returned... this is a 'good argument' for using the second version – dalanicolai Jul 15 '22 at 12:35list
are quite basic, just list of expressions with perhapsif
statements. – Dilna Jul 15 '22 at 12:49let
that make your code look strange to me. And additionally, I think I mostly see those local variables definitions getting placed on separate lines like in this example (although that is probably a matter of preference) – dalanicolai Jul 15 '22 at 12:58