From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: phillip.lord@newcastle.ac.uk (Phillip Lord) Newsgroups: gmane.emacs.help Subject: Re: In defense of Customize [was: Trying to right-align my window on startup] Date: Thu, 16 Jan 2014 10:06:37 +0000 Message-ID: <87lhyg5jgy.fsf@newcastle.ac.uk> References: <3cec217d-8adb-4e6c-b239-eff0c8b520c9@googlegroups.com> <5581e666-3500-4a30-abb2-6454e2398a01@default> <87txd57d2b.fsf@newcastle.ac.uk> <8a68f95d-4916-4a5d-a92c-b5de5f8f4d6e@default> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1389866827 30830 80.91.229.3 (16 Jan 2014 10:07:07 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 16 Jan 2014 10:07:07 +0000 (UTC) Cc: Rusi , help-gnu-emacs@gnu.org To: Drew Adams Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jan 16 11:07:14 2014 Return-path: Envelope-to: geh-help-gnu-emacs@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 1W3jqz-0004Vy-PU for geh-help-gnu-emacs@m.gmane.org; Thu, 16 Jan 2014 11:07:13 +0100 Original-Received: from localhost ([::1]:59538 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W3jqz-0004VN-9Q for geh-help-gnu-emacs@m.gmane.org; Thu, 16 Jan 2014 05:07:13 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55053) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W3jqe-0004OB-1d for help-gnu-emacs@gnu.org; Thu, 16 Jan 2014 05:06:56 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W3jqY-0003PR-1g for help-gnu-emacs@gnu.org; Thu, 16 Jan 2014 05:06:51 -0500 Original-Received: from cheviot22.ncl.ac.uk ([128.240.234.22]:60729) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W3jqX-0003P2-PJ for help-gnu-emacs@gnu.org; Thu, 16 Jan 2014 05:06:45 -0500 Original-Received: from smtpauth-vm.ncl.ac.uk ([10.8.233.129]) by cheviot22.ncl.ac.uk with esmtp (Exim 4.63) (envelope-from ) id 1W3jqV-0002rp-G7; Thu, 16 Jan 2014 10:06:44 +0000 Original-Received: from localhost (jangai.ncl.ac.uk [10.66.67.223]) (authenticated bits=0) by smtpauth-vm.ncl.ac.uk (8.13.8/8.13.8) with ESMTP id s0GA6hox030579 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Thu, 16 Jan 2014 10:06:43 GMT In-Reply-To: <8a68f95d-4916-4a5d-a92c-b5de5f8f4d6e@default> (Drew Adams's message of "Wed, 15 Jan 2014 09:28:11 -0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 128.240.234.22 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:95430 Archived-At: Drew Adams writes: >> I would like to have a "custom-setq" which set a var, checked to see >> whether the types were correct wrt customize, then crashed if not. It >> would be nice to use the knowledge of customize from lisp. > > See commands `customize-set-variable' and `customize-set-value'. > > (IMHO, `set-variable', which is also for setting a user variable, > should behave similarly, but it does not.) > These don't do quite what I want. As a random example, consider this: (defcustom pulse-flag (pulse-available-p) "Whether to use pulsing for momentary highlighting. Pulsing involves a bright highlight that slowly shifts to the background color. If the value is nil, highlight with an unchanging color until a key is pressed. If the value is `never', do no coloring at all. Any other value means to do the default pulsing behavior. If `pulse-flag' is non-nil, but `pulse-available-p' is nil, then this flag is ignored." :group 'pulse :type 'boolean) Now, this is type boolean. So we can do this.. (customize-set-value 'pulse-flag nil) and all is good. We can also do this... (customize-set-value 'pulse-flag "wrong") Now we have pulse-flag set to an illegal value. Of course, in this case, it won't matter because "wrong" will be interpreted as t. But it means I can set the variable to something which the GUI will not. I want this to throw an error. In this case, the ability to set an "illegal" value is actually useful, because the :type is wrong, as legal values are t, nil or 'never (according to the documentation) not just 'boolean. Why has this never been discovered? I would suggest two possibilities: a) the developers have never, ever set 'pulse-flag or b) they just used setq in their .emacs. If the latter is true, having a way of only setting legal values according to customize would have been helpful, because this would have crashed, and they would have fixed it. Phil