[Top][All Lists]

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

Arguing for a nilp function and where to put it

From: Pedro Andres Aranda Gutierrez
Subject: Arguing for a nilp function and where to put it
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.

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

reply via email to

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