From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Arguing for a nilp function and where to put it Date: Sat, 01 Apr 2023 09:10:02 +0300 Message-ID: <831ql416bp.fsf@gnu.org> References: Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3077"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Pedro Andres Aranda Gutierrez Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Apr 01 08:10:06 2023 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1piURC-0000fw-1S for ged-emacs-devel@m.gmane-mx.org; Sat, 01 Apr 2023 08:10:06 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1piUQw-0002Av-SU; Sat, 01 Apr 2023 02:09:50 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1piUQv-0002An-BX for emacs-devel@gnu.org; Sat, 01 Apr 2023 02:09:49 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1piUQu-0000Q3-PU; Sat, 01 Apr 2023 02:09:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=EybqkJLq88VH/v3FbOzLb0ZaPCwQ5vijjYzsDPf2cSo=; b=Cv8xn23hCMUx dOACC7XDB/co64B19xyZKcLV2TOPhDrHeGfD1MuSUIfqS+cEIoeCAuXVKUhlW6iY4KT4q5exivCeG E6JVwIGvqW3DoS+2debZmRjoqE11h9prNFv095GOMjabIqo1qwxs4n4I63D/GnXysj633cv4JlwTf NvMRAqJLprozWdHBpVceVYnLbB5qveO5+377zBiIKn23eyUi8g6hhVD0TndlC+0M90lBIwG5Zk0BS GqSRL8Scjyev99I1CQKxDoN8rL77ySe3r+MP9poqluODuW2FNOfNozTapiWJPydGP7oSPtCJ7ML9j kuB7qx8n24whM6Bwk794bw==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1piUQs-0004Ib-Np; Sat, 01 Apr 2023 02:09:47 -0400 In-Reply-To: (message from Pedro Andres Aranda Gutierrez on Sat, 1 Apr 2023 07:37:44 +0200) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:304964 Archived-At: > From: Pedro Andres Aranda Gutierrez > 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 ' 'safe-local-variable #'nilp) > > which is much cleaner than > > (put ' '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.