From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Jorge Newsgroups: gmane.emacs.help Subject: Re: How to customize an option to a dynamic value (computed by lisp form) Date: Fri, 26 Aug 2016 09:54:49 -0300 Message-ID: References: <87k2f69hvb.fsf@kuiper.lan.informatimago.com> <83832586-765e-4df4-917a-98458247d829@default> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1472216585 29285 195.159.176.226 (26 Aug 2016 13:03:05 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 26 Aug 2016 13:03:05 +0000 (UTC) Cc: "Pascal J. Bourguignon" , help-gnu-emacs@gnu.org To: Drew Adams Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Aug 26 15:02:56 2016 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bdGma-0006pU-Fy for geh-help-gnu-emacs@m.gmane.org; Fri, 26 Aug 2016 15:02:52 +0200 Original-Received: from localhost ([::1]:60311 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bdGmY-0005lx-0q for geh-help-gnu-emacs@m.gmane.org; Fri, 26 Aug 2016 09:02:50 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49512) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bdGlk-0005jg-EH for help-gnu-emacs@gnu.org; Fri, 26 Aug 2016 09:02:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bdGlU-00031m-Dq for help-gnu-emacs@gnu.org; Fri, 26 Aug 2016 09:01:59 -0400 Original-Received: from mail-qk0-x236.google.com ([2607:f8b0:400d:c09::236]:34202) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bdGlU-00031c-AI for help-gnu-emacs@gnu.org; Fri, 26 Aug 2016 09:01:44 -0400 Original-Received: by mail-qk0-x236.google.com with SMTP id t7so75233430qkh.1 for ; Fri, 26 Aug 2016 06:01:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-transfer-encoding; bh=6dFVVFxSfv4emS/IyfIhDUTuB3uf23iC64wbMr+CzXU=; b=B1n8ukogQUj/1Ny2lT0g3J4sIyvKsxe5+rZXc6R3pbIyV3lQ+s6U0kZhL1mAlYVPOa pbSi40DlQDDFns2AgNu/h8wsQdfn7s13C+Hil3wii2ZLQfh6AnLesDJG/yWoBMfUyHd6 MoLork0wIcpFRoZqZGhP9Eq6VDeo/lok+aXcVh1TBzhy3eM3RB9KKCAV05cfG+7mEa7m 6RalAJNAf+/rB5+4xj9jUhNqUt4wGNW+nBBIYDzRO/4pQaXzXth8w6WHtZReWxoGD/Um oQ0ibeTPcVUqjiso9Dmmm71JCG7/h3DV2ZKyTU1lZb/53BwkmuSwlcjWWAzLJIRoA/hK JxnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc:content-transfer-encoding; bh=6dFVVFxSfv4emS/IyfIhDUTuB3uf23iC64wbMr+CzXU=; b=Ix3jpsyrnyg7phyLuV/mhjmcyHZbEBrx9Zzykj39d98FXyx6PDtkM5FSTQT49WBNJ8 UZduAzDMMgkCQngqikTsapmHwi22vrjxAFbCo440Noc/w0CX5INEvai/+u5OLXjBSiyY OTBPpZMmhg/XxqKaQ0ExS1/nKXmSxXyhQnRlUnNZecILh0rPB8TS1q3wLeJmuzHkqiTc b0Wdh+vD7nt9sZ7O1hxT5p4XcRBjqS7C2UhuMPX2V/HkpX/KAqmonnhp+2AUz5qCHftq OsNmIaxzuLyTWcx04lJ5braP0Klk7PkPvkk8SjHEyq4cm2cTCxt68hfSu4Y1j2JQyICj BbkQ== X-Gm-Message-State: AE9vXwP65om1gC0tGsTrHQjh7nywwQiLxwswDHdGnqZf2AlNbFmW2pqxO3tsB2PBFUNsEl1vNsquqRH6QBB02A== X-Received: by 10.55.151.198 with SMTP id z189mr3044842qkd.70.1472216089962; Fri, 26 Aug 2016 05:54:49 -0700 (PDT) Original-Received: by 10.55.26.89 with HTTP; Fri, 26 Aug 2016 05:54:49 -0700 (PDT) In-Reply-To: <83832586-765e-4df4-917a-98458247d829@default> X-Google-Sender-Auth: AhN0mHXq-wAFOJw_8s_cfWTZbKs X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400d:c09::236 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.help:111201 Archived-At: On 25 August 2016 at 17:54, Drew Adams wrote: >> How can I elegantly combine both? And shouldn't elisp >> provide a convenient command for this? > > Try to specify the behavior you want (more clearly). Presumably > you are looking for a way, using Lisp (non-interactively), to set > an option value and get all of the behavior that you get when you > set it using the Customize UI (:set, :type, etc. control). I want one elisp function that, even when called non-interactively, respects custom-set and does type-checking. > A variable value is always "static", by definition of the word "value". > It's not clear (to me) just what you are looking for. I am sorry. By "static value" I meant "literal". > > BTW, you can easily check whether an option has been changed outside > Customize, i.e., using something like `setq' and not something like > `customize-set-variable', by invoking code such as this (taken from > `customize-rogue', which lets you open Customize for all such options): > > (defun rogue-option-p (symbol) > (let ((cval (or (get symbol 'customized-value) > (get symbol 'saved-value) > (get symbol 'standard-value)))) > (and cval ;Declared with defcustom. > (default-boundp symbol) ;Has a value. > (not (equal (eval (car cval)) > ;; Which does not match customize. > (default-value symbol)))))) Thank you for sharing this. But for now, I think I will rely on my memory (I just have to remember that three options are customized on org-init.el, and I can memorize the fact that options that use the value of org-directory are configured in org-init.el). --=20 =E2=80=A2 I am Brazilian. I hope my English is correct and I welcome corre= ctions. =E2=80=A2 Please adopt free formats like PDF, ODF, Org, LaTeX, Opus, WebM a= nd 7z. =E2=80=A2 Free (as in free speech) software for Android: https://f-droid.or= g/