unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stephen Leake <stephen_leake@stephe-leake.org>
To: emacs-devel@gnu.org
Subject: check argument count in defcustom :safe?
Date: Sat, 11 Apr 2015 10:42:32 -0500	[thread overview]
Message-ID: <85a8yehdsn.fsf@stephe-leake.org> (raw)

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



             reply	other threads:[~2015-04-11 15:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-11 15:42 Stephen Leake [this message]
2015-04-12  3:48 ` check argument count in defcustom :safe? Stefan Monnier
2015-04-12  6:45   ` Philipp Stephani
2015-04-12 10:00     ` Artur Malabarba
2015-04-12 11:59     ` Stefan Monnier

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=85a8yehdsn.fsf@stephe-leake.org \
    --to=stephen_leake@stephe-leake.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).