From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.help Subject: RE: Checking in Lisp if a given symbol has its original value Date: Tue, 31 Mar 2020 08:36:49 -0700 (PDT) Message-ID: References: <87eet9c557.fsf@oitofelix.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="57655"; mail-complaints-to="usenet@ciao.gmane.io" To: =?utf-8?B?QnJ1bm8gRsOpbGl4IFJlemVuZGUgUmliZWlybw==?= , help-gnu-emacs Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue Mar 31 17:38:20 2020 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jJIy4-000Esi-2G for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 31 Mar 2020 17:38:20 +0200 Original-Received: from localhost ([::1]:40452 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJIy3-0005FP-1W for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 31 Mar 2020 11:38:19 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35277) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJIwm-00044E-Cw for help-gnu-emacs@gnu.org; Tue, 31 Mar 2020 11:37:01 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jJIwk-0006oj-QY for help-gnu-emacs@gnu.org; Tue, 31 Mar 2020 11:37:00 -0400 Original-Received: from userp2120.oracle.com ([156.151.31.85]:60262) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jJIwi-0006lc-Um; Tue, 31 Mar 2020 11:36:57 -0400 Original-Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 02VFSo6m005992; Tue, 31 Mar 2020 15:36:52 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=mime-version : message-id : date : from : sender : to : subject : references : in-reply-to : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=ALzOnSptf/Q69E9/YDR8taXNNCGnpEepKg+iS/4OKLE=; b=DPjMmR1LEGZwXPB4UR1VKVtp6/xmpy2L+nT2XDkDt80DlQ+MlmohXc1hWeuhO5kl+q5t 4hAzvNWGrVE1iNAyqTGI5n/mUYPKNvGt0wsA0wRcsQ7GM/Lk+OwsWcYaZaZsJcZ9wUgX RGmCl8eBnll5dNWcUp1DdCfbY8duyKNeLIFhjxrhnTvv+MySqmKo+aQ8VtSFuDuXoXk/ hi4RMRYu0JV65XqEod7js6g0cEYYuSsA3gBJQc+EP8GXK891o6ykLTNOtlPaDYjLB5N0 34ZuhawEFc94+vZjMFpFo1+un0Qv3jZ4pI4URbjvpt9rnbFaN6pl3oM+q+xnDZANhNJU vw== Original-Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2120.oracle.com with ESMTP id 303aqhgtur-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 31 Mar 2020 15:36:51 +0000 Original-Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 02VFSQar037494; Tue, 31 Mar 2020 15:36:51 GMT Original-Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3030.oracle.com with ESMTP id 302g4rt3k9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 31 Mar 2020 15:36:51 +0000 Original-Received: from abhmp0006.oracle.com (abhmp0006.oracle.com [141.146.116.12]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 02VFaoS1000352; Tue, 31 Mar 2020 15:36:50 GMT In-Reply-To: <87eet9c557.fsf@oitofelix.com> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 16.0.4966.0 (x86)] X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9576 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 bulkscore=0 suspectscore=0 mlxscore=0 spamscore=0 malwarescore=0 mlxlogscore=999 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2003310140 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9576 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 phishscore=0 clxscore=1015 malwarescore=0 impostorscore=0 mlxlogscore=999 spamscore=0 mlxscore=0 priorityscore=1501 lowpriorityscore=0 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2003310140 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 156.151.31.85 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 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-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:122720 Archived-At: > What=E2=80=99s the canonical way of checking if a given symbol has its > original value, as reported by =E2=80=98describe-variable=E2=80=99? > I=E2=80=99ve come up with: > (defun standard-value-p (symbol) > "Return non-nil if SYMBOL has its original value." > (equal (eval (car (get symbol 'standard-value))) > symbol)) That's only for user options, aka customizable variables, aka variables defined with defcustom. See the Elisp manual, node Standard Properties. https://www.gnu.org/software/emacs/manual/html_node/elisp/Standard-Properti= es.html There's no way to check other variables, in general. For any given variable whose creation you control or monitor, you can of course record its initial value in some way. You can also use function `add-variable-watcher' to monitor changes to a variable's value. But again, you would want to do this from the outset, when it is created. See the Elisp manual, node Watching Variables. https://www.gnu.org/software/emacs/manual/html_node/elisp/Watching-Variable= s.html