help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Symbol's value as variable is void: defun


From: Emanuel Berg
Subject: Re: Symbol's value as variable is void: defun
Date: Fri, 02 Feb 2018 04:27:23 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Davin Pearson wrote:

> (defun load-file-most-recent (file) ...

Man, you have some serious style issues!

- lots of `setq's, and sequential `setq' to the
  same variable! here, rely on `let' and `let*'
  instead, and do it one thing at a time, then
  stay out
  
- long function

- everything tangled up: `setq' within `cond',
  deeply nested `if's within `setq', ...

You don't need explicit nils for single-branch
`if's:

    (if t   1)  ; 1
    (if nil 1)  ; nil

But for `if's with only one branch you are
benefitted from instead using `when' (and
`unless' for "if not") as this will drop the
need for explicit `progn's for the
multiform branch.

(when   t   1)   ; 1
(unless t   1)   ; nil

(when   nil 1)   ; nil
(unless nil 1)   ; 1

(when   nil 1 2) ; nil
(unless nil 1 2) ; 2 is return but "1" also happens

(when   t   1 2) ; ditto
(unless t   1 2) ; nil

-- 
underground experts united
http://user.it.uu.se/~embe8573


reply via email to

[Prev in Thread] Current Thread [Next in Thread]