From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Oleksandr Gavenko Newsgroups: gmane.emacs.bugs Subject: bug#22703: 24.5; PROPOSAL: Is there a way to update available choices for defcustom variable? Date: Tue, 16 Feb 2016 20:20:23 +0200 Message-ID: <871t8cfrfc.fsf@gavenkoa.example.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1455646967 16156 80.91.229.3 (16 Feb 2016 18:22:47 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 16 Feb 2016 18:22:47 +0000 (UTC) To: 22703@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Feb 16 19:22:36 2016 Return-path: Envelope-to: geb-bug-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 1aVkGg-00046r-TR for geb-bug-gnu-emacs@m.gmane.org; Tue, 16 Feb 2016 19:22:35 +0100 Original-Received: from localhost ([::1]:49356 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aVkGg-0006Lb-5z for geb-bug-gnu-emacs@m.gmane.org; Tue, 16 Feb 2016 13:22:34 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48311) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aVkFI-0004EV-2J for bug-gnu-emacs@gnu.org; Tue, 16 Feb 2016 13:21:12 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aVkFC-00005i-Mw for bug-gnu-emacs@gnu.org; Tue, 16 Feb 2016 13:21:07 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:39675) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aVkFC-00005c-Ia for bug-gnu-emacs@gnu.org; Tue, 16 Feb 2016 13:21:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1aVkFC-00088Q-Ew for bug-gnu-emacs@gnu.org; Tue, 16 Feb 2016 13:21:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Oleksandr Gavenko Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 16 Feb 2016 18:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 22703 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.145564684031229 (code B ref -1); Tue, 16 Feb 2016 18:21:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 16 Feb 2016 18:20:40 +0000 Original-Received: from localhost ([127.0.0.1]:38349 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aVkEp-00087d-QA for submit@debbugs.gnu.org; Tue, 16 Feb 2016 13:20:40 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:57259) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aVkEn-00087P-Kz for submit@debbugs.gnu.org; Tue, 16 Feb 2016 13:20:37 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aVkEh-0008P7-Fi for submit@debbugs.gnu.org; Tue, 16 Feb 2016 13:20:32 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:45647) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aVkEh-0008P3-DU for submit@debbugs.gnu.org; Tue, 16 Feb 2016 13:20:31 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48227) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aVkEg-0003Ot-7h for bug-gnu-emacs@gnu.org; Tue, 16 Feb 2016 13:20:31 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aVkEc-0008OV-SU for bug-gnu-emacs@gnu.org; Tue, 16 Feb 2016 13:20:30 -0500 Original-Received: from mail-lb0-x22f.google.com ([2a00:1450:4010:c04::22f]:34546) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aVkEc-0008OM-K8 for bug-gnu-emacs@gnu.org; Tue, 16 Feb 2016 13:20:26 -0500 Original-Received: by mail-lb0-x22f.google.com with SMTP id of3so10597284lbc.1 for ; Tue, 16 Feb 2016 10:20:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; bh=dms+rutwfCeeXk67vSJBE7lB7PZnPP/MbcXzzpbKwGU=; b=jc4oKAdh3MTVdiE4GfG9TlHgejQcQEltQ3DhVGuW7UIO3OrsxnNPkPVEYldzSHASWh JqoHka8UoUaFeScUJkKEfDP8AjRB1uoqusV/zgUXOwrY//YcG/RlxSOFKCEfYb9WTtqy aYF8cZ9E9XXIQC1wpQzx5j3DVPznJMpwaPc23R4Tf0tIDQZs61bFeeNV6Vr4vvTPx3Ke xfK4C0k7ArLdzwraHeMvb5dbfVe7XYMKxM0EDjNKejhxK1LIyPtOCyMNDUd9lj7Orm2f h8lfCPi5igF0cUbhhoeFAJzAAQStqeOLGbgKBiiuCUG+Wfn/NT7GvYJHe72U3j5cpBsj WxJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-type:content-transfer-encoding; bh=dms+rutwfCeeXk67vSJBE7lB7PZnPP/MbcXzzpbKwGU=; b=ZZoOFlP1rO/rkMfkE+X77A0mWqQYors8WLlOSPyi5b5CBPqOoGtsE9TmhdkYCyJ+/z ui4XYT7efsWQElrhoCa+bTeyZ5y0qQUMY0qJ/ob8VEegCQKrevW4zvCMzLEXjnabnWjp WQzdMRehhpJotUcjFiVJ/AI9jmVqDFnSBhCHunAdaBurcY+a4JAIhgF/QIQc2+kAwTSO 4fA6RxcNHhJF11KkE0Z+kGg1cVNHjTGcEtFzrbdZ3k5JjegjJLXix+p9WgWhml0Fjh6d fLlOuMoMv6Xa0Emt6hTBClQrrwaDngOJjjRdbzTTelCtCxxPJnxKSPjjxW1YtWwwDncc JUjA== X-Gm-Message-State: AG10YOS/5ugmvw9AwZvbOVSKMIk6WdFdmpFVug9UeYqjQhoZeXrK7YT6va98y5bg7352zg== X-Received: by 10.25.160.194 with SMTP id j185mr8738987lfe.128.1455646825334; Tue, 16 Feb 2016 10:20:25 -0800 (PST) Original-Received: from desktop ([46.118.53.144]) by smtp.gmail.com with ESMTPSA id xf10sm4486735lbb.23.2016.02.16.10.20.24 for (version=TLSv1/SSLv3 cipher=OTHER); Tue, 16 Feb 2016 10:20:24 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:113145 Archived-At: Recently I ask question: http://emacs.stackexchange.com/questions/20350/defcustom-values-for-selec= ting-from-function-call because I didn't understand show to build code from that I read in docs. While answer to question help me to build my first "customize" code it miss main point and I think because the way Emacs customize API works, so nobody even think about doing as I asked. I have values: (defvar my/python-checker-alist '((pylint . (my/python-pylint-command my/python-pylint-args)) (pep8 . (my/python-pep8-command my/python-pep8-args)) (pyflakes . (my/python-pyflakes-command my/python-pyflakes-args))) "Known Python source code checkers.") and want to build `defcustom' definition based on that values: (choice (const . pylint) (const . pep8) (const . pyflakes)) (defcustom my/python-default-checker 'pyflakes "Default Python source code checker. See `my/python-checker-alist' for = full alist." :group 'my/python :type (cons 'choice (mapcar (lambda (e) (cons 'const (car e))) my/pytho= n-checker-alist)) ) I am worrying is there a mechanic that **automatically** update `:type' val= ue when user visit: M-x customize-group M-x customize-variable with my variable? Official info states: The argument of =E2=80=98:type=E2=80=99 is evaluated, but only once when = the =E2=80=98defcustom=E2=80=99 is executed, so it isn=E2=80=99t useful for t= he value to vary. If someone potentially extend my/python-checker-alist his addition would be invisible in my/python-default-checker. I thing it is wrong to ask someone not only to update possible values: (with-eval-after-load 'my/python (add-to-list 'my/python-checker-alist ...)) but also somehow to update default values (for my/python-default-checker) synchronously. Are there standard convention for such situation? I see ":options" and "custom-add-frequent-value" but this is not useful when ":type (choice ...)" used. Also it cumbersome even in case of :options ask = any extension developers to call "custom-add-frequent-value" for their addition= s. ":set" function called after user see menu with pre-filled values while desired situation when used see updated list of available options. Solution to this request is to allow value of ":type" be a function which is evaluated on M-x customize-group / M-x customize-variable. --=20 http://defun.work/