From: Pedro Andres Aranda Gutierrez <paaguti@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Arguing for a nilp function and where to put it
Date: Sat, 1 Apr 2023 09:09:22 +0200 [thread overview]
Message-ID: <CAO48Bk9STiFyZdyAhjvendyJm9mJboxbJQ5-EU0H8PpkoBEcyw@mail.gmail.com> (raw)
In-Reply-To: <831ql416bp.fsf@gnu.org>
Hi Eli,
it might be that sometimes I'd like a bit more of logic...
When you want to check if a variable is an integer, you use integerp,
when you want to check if a variable is a string, you use stringp, etc.
so I was expecting, in pure logic and in the frenzy of real life, that
when you want to check if a variable is nil, you use nilp
So, null is an outlier... no problem, can live with that... intuition
failed me <blush>RTFM</blush>...
Anyway, thx
/PA
On Sat, 1 Apr 2023 at 08:09, Eli Zaretskii <eliz@gnu.org> wrote:
>
> > From: Pedro Andres Aranda Gutierrez <paaguti@gmail.com>
> > Date: Sat, 1 Apr 2023 07:37:44 +0200
> >
> > Use case for a nilp function:
> >
> > I have a buffer-local variable with a default value, and I want to
> > allow to (silently) set it to nil (and only to nil) from
> > .dir-locals.el or Local Variables.
> >
> > Currently I have
> >
> > (defun nilp(v) (unless v t))
> >
> > and I use it with
> >
> > (put '<variable> 'safe-local-variable #'nilp)
> >
> > which is much cleaner than
> >
> > (put '<variable> 'safe-local-variable (lambda (p) (unless p t)))
> >
> > every time I need it. I think other people may benefit from having
> > this simple function as part of Emacs and I'm not sure whether the
> > elisp form would be better than something more lower level like
> > integerp and in which file it would reside best.
>
> Why cannot you use the existing function 'null'?
>
> If 'null' doesn't fit the bill, please explain why.
--
Fragen sind nicht da um beantwortet zu werden,
Fragen sind da um gestellt zu werden
Georg Kreisler
Headaches with a Juju log:
unit-basic-16: 09:17:36 WARNING juju.worker.uniter.operation we should
run a leader-deposed hook here, but we can't yet
next prev parent reply other threads:[~2023-04-01 7:09 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-01 5:37 Arguing for a nilp function and where to put it Pedro Andres Aranda Gutierrez
2023-04-01 6:01 ` tomas
2023-04-01 6:07 ` Michael Albinus
2023-04-01 6:10 ` Eli Zaretskii
2023-04-01 7:09 ` Pedro Andres Aranda Gutierrez [this message]
2023-04-02 21:28 ` Roland Winkler
2023-04-03 3:02 ` Richard Stallman
2023-04-03 3:34 ` Emanuel Berg
2023-04-03 12:46 ` Andreas Schwab
2023-04-03 18:48 ` Roland Winkler
2023-04-03 23:44 ` Emanuel Berg
2023-04-04 2:56 ` Richard Stallman
2023-04-05 7:24 ` Emanuel Berg
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=CAO48Bk9STiFyZdyAhjvendyJm9mJboxbJQ5-EU0H8PpkoBEcyw@mail.gmail.com \
--to=paaguti@gmail.com \
--cc=eliz@gnu.org \
--cc=emacs-devel@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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
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).