From: jack-mac <duthen.mac@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: What does ":noerror" do?
Date: Mon, 14 Oct 2013 02:33:19 -0700 (PDT) [thread overview]
Message-ID: <ae51e8fc-8c0b-492b-8f4d-1742b3fed133@googlegroups.com> (raw)
In-Reply-To: <mailman.3911.1381634813.10748.help-gnu-emacs@gnu.org>
Le dimanche 13 octobre 2013 05:26:50 UTC+2, Xue Fuqiao a écrit :
> I see, thank you. Personally, I often use 'no-error or 'noerror.
Me too!
When an argument (whether optional or required) is expected to be a boolean,
the expected values are usually `t' and `nil'.
But I (try to) NEVER use any of these values (lexically speaking, of course).
Instead, I use the names of the arguments, the way `eldoc' displays them in the echo-area,
so that, when I (or someone else) read the code some time later,
I can directly understand what I meant when I wrote it.
For a `true' value (non-nil), I use the (quoted symbol) name of the argument, e.g. 'verbose or 'noerror.
For a `false' value (nil), I just use the opposite: (not 'verbose) or (not 'no error).
Of course, with "negative" flags (whose name begins with "no"),
it leads to an ugly double negation :(
So, for example, as the function `load' is described as:
,----[ M-h f load RET ]
| load is a built-in function in `C source code'.
|
| (load FILE &optional NOERROR NOMESSAGE NOSUFFIX MUST-SUFFIX)
`----
I would write, for example:
(load file 'noerror 'nomessage) ; if I want no error and no message
or
(load file (not 'noerror) 'nomessage) ; if I want an error but no message
And, yes, in the original context, :noerror 'noerror 'no-error t or any other non-nil value
would produce almost(1) the same result.
(1) From the point of view of the machine code, I mean.
Clearly, it produces a lot of different results in the head or the heart of the humans reading the code and in the forum contents!
next prev parent reply other threads:[~2013-10-14 9:33 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.3905.1381618634.10748.help-gnu-emacs@gnu.org>
2013-10-12 23:06 ` What does ":noerror" do? Pascal J. Bourguignon
2013-10-13 2:14 ` Drew Adams
2013-10-13 3:26 ` Xue Fuqiao
[not found] ` <mailman.3911.1381634813.10748.help-gnu-emacs@gnu.org>
2013-10-14 9:33 ` jack-mac [this message]
[not found] ` <mailman.3909.1381630514.10748.help-gnu-emacs@gnu.org>
2013-10-13 14:17 ` Pascal J. Bourguignon
2013-10-13 16:27 ` Drew Adams
2013-10-14 10:22 ` Xue Fuqiao
2013-10-12 22:57 Xue Fuqiao
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ae51e8fc-8c0b-492b-8f4d-1742b3fed133@googlegroups.com \
--to=duthen.mac@gmail.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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.