all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Arguing for a nilp function and where to put it
@ 2023-04-01  5:37 Pedro Andres Aranda Gutierrez
  2023-04-01  6:01 ` tomas
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Pedro Andres Aranda Gutierrez @ 2023-04-01  5:37 UTC (permalink / raw)
  To: emacs-devel

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.

/PA
-- 
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



^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2023-04-05  7:24 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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.