From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: phillip.lord@russet.org.uk (Phillip Lord) Newsgroups: gmane.emacs.devel Subject: RFM: How to make a buffer-local var in C layer Date: Mon, 14 Sep 2015 15:41:13 +0100 Message-ID: <878u89njw6.fsf_-_@russet.org.uk> References: <20150821093606.11577.60349@vcs.savannah.gnu.org> <87d1y272f9.fsf@russet.org.uk> <87a8t6jbuy.fsf@russet.org.uk> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1442241718 3109 80.91.229.3 (14 Sep 2015 14:41:58 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 14 Sep 2015 14:41:58 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Sep 14 16:41:54 2015 Return-path: Envelope-to: ged-emacs-devel@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 1ZbUx6-0006Ci-3E for ged-emacs-devel@m.gmane.org; Mon, 14 Sep 2015 16:41:52 +0200 Original-Received: from localhost ([::1]:41362 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZbUx5-0001KJ-Gm for ged-emacs-devel@m.gmane.org; Mon, 14 Sep 2015 10:41:51 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43023) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZbUwc-0001DX-Qg for emacs-devel@gnu.org; Mon, 14 Sep 2015 10:41:26 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZbUwY-0007EZ-Rb for emacs-devel@gnu.org; Mon, 14 Sep 2015 10:41:22 -0400 Original-Received: from cheviot22.ncl.ac.uk ([128.240.234.22]:44228) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZbUwY-0007DZ-Md for emacs-devel@gnu.org; Mon, 14 Sep 2015 10:41:18 -0400 Original-Received: from smtpauth-vm.ncl.ac.uk ([10.8.233.129] helo=smtpauth.ncl.ac.uk) by cheviot22.ncl.ac.uk with esmtp (Exim 4.63) (envelope-from ) id 1ZbUwU-0001eB-Fy for emacs-devel@gnu.org; Mon, 14 Sep 2015 15:41:15 +0100 Original-Received: from jangai.ncl.ac.uk ([10.66.67.223] helo=localhost) by smtpauth.ncl.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.63) (envelope-from ) id 1ZbUwU-00076E-0G for emacs-devel@gnu.org; Mon, 14 Sep 2015 15:41:14 +0100 In-Reply-To: (Stefan Monnier's message of "Sun, 6 Sep 2015 19:03:38 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 128.240.234.22 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:189946 Archived-At: Sorry for the total newbie noise, but I am trying to add a buffer-local variable to the undo machinary. In emacs-lisp I would do... (defvar-local undo-buffer-undoably-changed nil "Non-nil means that that the buffer has had a recent undo-able change. Recent means since the value of this variable was last set explicitly to nil, usually as part of the undo machinary.") My C is very poor (I'm learning it as I go). But I *think* I need to do this in the C layer, as I am going to use and set this directly from within undo.c. Or am I wrong about this? Is it easier to just use the lisp above and access it's value in C (not sure how do do that either). If I need to do this in C, I have worked out how to add new variables to Emacs in C, but it's the buffer-local bit that is causing problems. Do, I need to do follow all the steps in buffer.c, which look something like - call it "buffer-undoably-changed" - add to the structure in buffer.h - add a bset-* method - do DEFVAR_PER_BUFFER in syms_of_buffer_c The background to this is in this thread here: https://lists.gnu.org/archive/html/emacs-devel/2015-09/msg00013.html Sorry for dumb questions; this bit of Emacs is totally new to me. Phil