From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stephen Leake Newsgroups: gmane.emacs.devel Subject: check argument count in defcustom :safe? Date: Sat, 11 Apr 2015 10:42:32 -0500 Message-ID: <85a8yehdsn.fsf@stephe-leake.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1428766995 3318 80.91.229.3 (11 Apr 2015 15:43:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 11 Apr 2015 15:43:15 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Apr 11 17:43:04 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YgxYl-0004CI-LU for ged-emacs-devel@m.gmane.org; Sat, 11 Apr 2015 17:43:03 +0200 Original-Received: from localhost ([::1]:43045 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YgxYk-0007fE-IL for ged-emacs-devel@m.gmane.org; Sat, 11 Apr 2015 11:43:02 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35290) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YgxYW-0007f5-Cv for emacs-devel@gnu.org; Sat, 11 Apr 2015 11:42:49 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YgxYT-0003AJ-5o for emacs-devel@gnu.org; Sat, 11 Apr 2015 11:42:48 -0400 Original-Received: from gproxy6-pub.mail.unifiedlayer.com ([67.222.39.168]:55446) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1YgxYS-0002yj-T2 for emacs-devel@gnu.org; Sat, 11 Apr 2015 11:42:45 -0400 Original-Received: (qmail 12141 invoked by uid 0); 11 Apr 2015 15:42:41 -0000 Original-Received: from unknown (HELO cmgw4) (10.0.90.85) by gproxy6.mail.unifiedlayer.com with SMTP; 11 Apr 2015 15:42:41 -0000 Original-Received: from host114.hostmonster.com ([74.220.207.114]) by cmgw4 with id Elia1q00c2UdiVW01lid3y; Sat, 11 Apr 2015 15:42:39 -0600 X-Authority-Analysis: v=2.1 cv=C4J6l2/+ c=1 sm=1 tr=0 a=CQdxDb2CKd3SRg4I0/XZPQ==:117 a=CQdxDb2CKd3SRg4I0/XZPQ==:17 a=DsvgjBjRAAAA:8 a=f5113yIGAAAA:8 a=2wGvvwaKUHMA:10 a=9i_RQKNPAAAA:8 a=hEr_IkYJT6EA:10 a=x_XPkuGwIRMA:10 a=e9J7MTPGsLIA:10 a=NX_xCdbv1HbYbC9dibgA:9 Original-Received: from [76.218.37.33] (port=56688 helo=TAKVER) by host114.hostmonster.com with esmtpa (Exim 4.82) (envelope-from ) id 1YgxYK-0003dC-6G for emacs-devel@gnu.org; Sat, 11 Apr 2015 09:42:36 -0600 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (windows-nt) X-Identified-User: {2442:host114.hostmonster.com:stephele:stephe-leake.org} {sentby:smtp auth 76.218.37.33 authed with stephen_leake@stephe-leake.org} X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 67.222.39.168 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:185295 Archived-At: I have changed the signature of a defcustom variable; it used to require a function taking 2 args, now it takes 3. So I'd like to have the :safe predicate check the argument count, not just `functionp'. The argument count is only available for byte-compiled functions, so I'd have to skip that check for non-compiled. But most of the time, the check will be useful. The low-level C code that executes byte code checks the argument count, but I don't see any way to access the argument count from lisp. Am I missing something? To be specific, here's the defcustom: (defcustom ada-case-identifier 'ada-mixed-case "..." :type '(choice (const ada-mixed-case) (const ada-lower-case) (const ada-upper-case)) :group 'ada :safe 'functionp) What can I add to the :safe expression to check the argument count? -- -- Stephe