all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: phillip.lord@russet.org.uk (Phillip Lord)
To: emacs-devel@gnu.org
Subject: RFM: How to make a buffer-local var in C layer
Date: Mon, 14 Sep 2015 15:41:13 +0100	[thread overview]
Message-ID: <878u89njw6.fsf_-_@russet.org.uk> (raw)
In-Reply-To: <jwvd1xvmak5.fsf-monnier+emacsdiffs@gnu.org> (Stefan Monnier's message of "Sun, 6 Sep 2015 19:03:38 -0400")



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



  reply	other threads:[~2015-09-14 14:41 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20150821093606.11577.60349@vcs.savannah.gnu.org>
     [not found] ` <E1ZSik4-000326-4S@vcs.savannah.gnu.org>
2015-08-30  3:30   ` [Emacs-diffs] fix/no-undo-boundary-on-secondary-buffer-change e5ff575 2/2: Add a timer to ensure undo-boundaries in buffers Stefan Monnier
2015-09-01 12:24     ` Phillip Lord
2015-09-01 16:16       ` Stefan Monnier
2015-09-01 17:19         ` Phillip Lord
2015-09-06 23:03           ` Stefan Monnier
2015-09-14 14:41             ` Phillip Lord [this message]
2015-09-15  1:48               ` RFM: How to make a buffer-local var in C layer Stefan Monnier
2015-09-15 12:08                 ` Phillip Lord
2015-09-15 14:18                   ` Stefan Monnier
2015-09-15 14:20                   ` Stefan Monnier
2015-09-15 15:27                     ` Phillip Lord

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878u89njw6.fsf_-_@russet.org.uk \
    --to=phillip.lord@russet.org.uk \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.