From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Philipp Stephani Newsgroups: gmane.emacs.devel Subject: Re: Propagating local variables? Date: Sat, 19 May 2018 14:06:41 +0200 Message-ID: References: <87in7mv5jn.fsf@xps13.shealevy.com> <1148d91b-92a2-e970-e6cb-0fcc0a951c8c@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="00000000000081e9f5056c8de7af" X-Trace: blaine.gmane.org 1526731497 7292 195.159.176.226 (19 May 2018 12:04:57 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 19 May 2018 12:04:57 +0000 (UTC) Cc: emacs-devel@gnu.org To: =?UTF-8?Q?Cl=C3=A9ment_Pit=2DClaudel?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat May 19 14:04:52 2018 Return-path: Envelope-to: ged-emacs-devel@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 1fK0bU-0001mq-95 for ged-emacs-devel@m.gmane.org; Sat, 19 May 2018 14:04:52 +0200 Original-Received: from localhost ([::1]:42953 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fK0da-0006Gc-Js for ged-emacs-devel@m.gmane.org; Sat, 19 May 2018 08:07:02 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34701) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fK0dT-0006GQ-Lx for emacs-devel@gnu.org; Sat, 19 May 2018 08:06:56 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fK0dS-0004IN-P6 for emacs-devel@gnu.org; Sat, 19 May 2018 08:06:55 -0400 Original-Received: from mail-ot0-x236.google.com ([2607:f8b0:4003:c0f::236]:37479) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fK0dS-0004IG-JQ for emacs-devel@gnu.org; Sat, 19 May 2018 08:06:54 -0400 Original-Received: by mail-ot0-x236.google.com with SMTP id 77-v6so12135370otd.4 for ; Sat, 19 May 2018 05:06:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=uPMwD85WaUmMC2iB2KIXLJ6LeHLmk7L2noJdpKR+YIU=; b=Obh/m5AjrVLsVnD1uuk8gnfd5Lp4RcIjjJPFU6gNtefyvYwMSdaeh4sf8PquHn7R1M 4bQYknB12KaPFfwx5jzqIZ0B1+ssmfw6Gm+KMFUZL4dWWjoR1zDDS2dubI31Cpu/+FeW 1uPp861udV5jefky+UbdbHaZDJ8fMgc0B7JwFWtjw8XfWyLPjTcldGmwL0H9ukweITRM x+PQMgQLMa6ebFcD8dLQO+yYJ7ZssEr638bKrxGTSKvap45lvwWl28sFSMpq2UkmmbJz L9LQ1Kfxwk300QGM/vIQc1ZtwOb67BI/iA83ww5C+EjNBgmt9m9+4A/CApgitwB9WyGZ foTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=uPMwD85WaUmMC2iB2KIXLJ6LeHLmk7L2noJdpKR+YIU=; b=PUFMX2N782D2CQ6O6N6tchfiD9HGqRRgUNWlVd0evWARyQC/4Qp3+gcoDTfnwYCi1T DasmhBpuOfJFjmfdk88MqPmjKYVLokuNFYuzyvJnD6Xv/nNI212GIqDjL9JCmKKxDuEN JRUFeduWSlIFJYaLe/+LFg4PmwLksIKnHt3SAZwT9q0abhdIlI1s9VE3FTE8dDjsXleE wURbYFkVlgCahyNhfjRF87a+U3TULTW+oeUZCmuxaP7PJ0xFTY1JHL1BA1zP4D+c+He2 vXOYKJ2q2PjlzGCVMVhDZzuaiki4k0HNabwme07HshGB84x52JR2R6XJaHrrO1eQdy87 Tn3w== X-Gm-Message-State: ALKqPweh3Yigl6mT1CjiSsMff8D7ovhQ4CRz7HR1ZJq9nOTpQ1diA3X+ daX+w2o26Yzq1MmwpqYtMnEJVqUN1PKV1i3Lc6c= X-Google-Smtp-Source: AB8JxZrxnEZBD3QewlykqU7eRUspekCdK+H14pNRDtB7GZU4Aa9rLoZSTc6lKqGHu3GYHPjJ60PZ1OgkqTDn8ra42LA= X-Received: by 2002:a9d:328:: with SMTP id 37-v6mr8148361otv.229.1526731613791; Sat, 19 May 2018 05:06:53 -0700 (PDT) In-Reply-To: <1148d91b-92a2-e970-e6cb-0fcc0a951c8c@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4003:c0f::236 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:225437 Archived-At: --00000000000081e9f5056c8de7af Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Cl=C3=A9ment Pit-Claudel schrieb am Do., 17. Mai 20= 18 um 16:28 Uhr: > On 2018-05-17 08:18, Shea Levy wrote: > > 2. How do we actually ensure the variables are propagated? I wrote the > > inherit-local package to do the propagation, but there's no obvious > > hook point to call it (thus the advice around generate-new-buffer) > > We now have variable watchers: > > > add-variable-watcher is a built-in function in =E2=80=98C source code= =E2=80=99. > > > > (add-variable-watcher SYMBOL WATCH-FUNCTION) > > > > Cause WATCH-FUNCTION to be called when SYMBOL is set. > > > > It will be called with 4 arguments: (SYMBOL NEWVAL OPERATION WHERE). > > SYMBOL is the variable being changed. > > NEWVAL is the value it will be changed to. > > OPERATION is a symbol representing the kind of change, one of: =E2=80= =98set=E2=80=99, > > =E2=80=98let=E2=80=99, =E2=80=98unlet=E2=80=99, =E2=80=98makunbound=E2= =80=99, and =E2=80=98defvaralias=E2=80=99. > > WHERE is a buffer if the buffer-local value of the variable is being > > changed, nil otherwise. > > > > All writes to aliases of SYMBOL will call WATCH-FUNCTION too. > > These could probably be used for that purpose: > No, they are only for debugging purposes. --00000000000081e9f5056c8de7af Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


Cl=C3= =A9ment Pit-Claudel <cpitclaude= l@gmail.com> schrieb am Do., 17. Mai 2018 um 16:28=C2=A0Uhr:
On 2018-05-17 08:18, Shea Levy wrote:
> 2. How do we actually ensure the variables are propagated? I wrote the=
>=C2=A0 =C2=A0 inherit-local package to do the propagation, but there= 9;s no obvious
>=C2=A0 =C2=A0 hook point to call it (thus the advice around generate-ne= w-buffer)

We now have variable watchers:

> add-variable-watcher is a built-in function in =E2=80=98C source code= =E2=80=99.
>
> (add-variable-watcher SYMBOL WATCH-FUNCTION)
>
> Cause WATCH-FUNCTION to be called when SYMBOL is set.
>
> It will be called with 4 arguments: (SYMBOL NEWVAL OPERATION WHERE). > SYMBOL is the variable being changed.
> NEWVAL is the value it will be changed to.
> OPERATION is a symbol representing the kind of change, one of: =E2=80= =98set=E2=80=99,
> =E2=80=98let=E2=80=99, =E2=80=98unlet=E2=80=99, =E2=80=98makunbound=E2= =80=99, and =E2=80=98defvaralias=E2=80=99.
> WHERE is a buffer if the buffer-local value of the variable is being > changed, nil otherwise.
>
> All writes to aliases of SYMBOL will call WATCH-FUNCTION too.

These could probably be used for that purpose:

No, they are only for debugging purposes.= =C2=A0
--00000000000081e9f5056c8de7af--