From: Emanuel Berg <moasen@zoho.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Symbol's value as variable is void: defun
Date: Fri, 02 Feb 2018 04:27:23 +0100 [thread overview]
Message-ID: <861si43wbo.fsf@zoho.com> (raw)
In-Reply-To: 4d2444cf-cca2-49b6-9afa-524aa7d28569@googlegroups.com
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
next prev parent reply other threads:[~2018-02-02 3:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-02 2:54 Symbol's value as variable is void: defun Davin Pearson
2018-02-02 3:27 ` Emanuel Berg [this message]
2018-02-02 7:50 ` tomas
2018-02-02 8:22 ` Emanuel Berg
2018-02-02 7:48 ` tomas
2018-02-02 11:39 ` Ben Bacarisse
2018-02-02 18:10 ` John Mastro
2018-02-05 2:59 ` Davin Pearson
2018-02-05 3:04 ` Emanuel Berg
2018-02-05 6:39 ` Davin Pearson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=861si43wbo.fsf@zoho.com \
--to=moasen@zoho.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).