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

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

Re: What does ":noerror" do?


From: jack-mac
Subject: Re: What does ":noerror" do?
Date: Mon, 14 Oct 2013 02:33:19 -0700 (PDT)
User-agent: G2/1.0

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!


reply via email to

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