From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: uzibalqa Newsgroups: gmane.emacs.help Subject: Re: [External] : Saving variables for use between emacs sessions Date: Fri, 16 Sep 2022 08:05:03 +0000 Message-ID: References: <87fsgskdk4.fsf@gmail.com> <87v8po6a5u.fsf@mbork.pl> <9NtSR1Mo-D0FKDHQrU7DS26HNA_Bzp59Tgk_tXgVrNdUBd_k7tmn3TDbA-nZ2ttXKMq1cZYjgsQaGuxbY5ngGZoUg1QAwumZu3BL7Slg8z8=@proton.me> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17842"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Drew Adams , Marcin Borkowski , Robert Pluim , uzibalqa via Users list for the GNU Emacs text editor To: Jean Louis Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Fri Sep 16 10:11:16 2022 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 1oZ6RQ-0004Sg-5Q for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 16 Sep 2022 10:11:16 +0200 Original-Received: from localhost ([::1]:36572 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oZ6RO-0003pB-RO for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 16 Sep 2022 04:11:14 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49684) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oZ6Lf-0003dR-7v for help-gnu-emacs@gnu.org; Fri, 16 Sep 2022 04:05:32 -0400 Original-Received: from mail-4318.protonmail.ch ([185.70.43.18]:40631) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oZ6Lb-0007sz-7X for help-gnu-emacs@gnu.org; Fri, 16 Sep 2022 04:05:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=proton.me; s=protonmail; t=1663315512; x=1663574712; bh=86RhT+6QMvMFTlGdymyMs1GSvnT9M6EU1krlYYQnz+I=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID; b=IGc3T9nlF2ekXMe01i9nWjDd7F4GA0DHgDPH1DdhNABjMBvkYYCDyRnWYxnRlcWqb 2NgmGtxbAR1nN9IUMGAlak5x2+XfzEP9mS9ChcIPhbFyaBCprQxBTbAxWxKjKnmh9J x5gH958drOfSH2fnor7bzANA9/7bHpIo9FFW4ZhWgwaYB806NRdD9B3n7GCfXykyPo JK5+RvVnfIrkOyViRz1aF69Tnlwi4jCrQeKefB5kmCNDXFEmJ+XJVNFbkkyq1Y2W8n SgV4SN9hGSUl21cUh+BMZg4VmqpHPBrlIXm9zFPv/UzgzaP1DXGt4fY3plrrHS93cd 0YD/OruLdnSKg== In-Reply-To: Feedback-ID: 52887082:user:proton Received-SPF: pass client-ip=185.70.43.18; envelope-from=uzibalqa@proton.me; helo=mail-4318.protonmail.ch X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 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:139511 Archived-At: ------- Original Message ------- On Friday, September 16th, 2022 at 7:30 AM, Jean Louis w= rote: > * uzibalqa uzibalqa@proton.me [2022-09-16 05:42]: >=20 > > I do not understand. Once I define a variable with the declaration "def= custom", > > how can I make a function change the value? >=20 >=20 > Hyperbole link: > {C-h f defcustom RET} >=20 > where it says: >=20 > This macro calls =E2=80=98custom-declare-variable=E2=80=99. If you want t= o > programmatically alter a customizable variable (for instance, to > write a package that extends the syntax of a variable), you can > call that function directly. >=20 > Hyperbole link: >=20 > {C-h f custom-declare-variable RET} >=20 > (custom-declare-variable SYMBOL DEFAULT DOC &rest ARGS) >=20 > Like =E2=80=98defcustom=E2=80=99, but SYMBOL and DEFAULT are evaluated as= normal arguments. > DEFAULT should be an expression to evaluate to compute the default value, > not the default value itself. >=20 > That way you can programmatically change variables created by > `defcustom'. I would need some help with using it, particularly with using SYMBOL, and D= EFAULT where the value itself cannot be used. For instance (defgroup frame-pos nil "Set position of frame." :group 'convenience) (defcustom fxpos 8 "X position of initial frame." :type 'integer :group 'frame-pos) This is the function that should update the value in defcustom=20 (defun frame-shift (frame) (let* ( (lft (car (frame-position))) (wdt (frame-outer-width frame)) =09 (nlft (+ lft (/ wdt 2))) ) (set-frame-position frame nlft ntop) (custom-declare-variable 'typex-fxpos nlft)) )