[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How do I tell when the current buffer is the minibuffer?
From: |
Alan Mackenzie |
Subject: |
Re: How do I tell when the current buffer is the minibuffer? |
Date: |
Sun, 6 Mar 2016 21:44:53 +0000 |
User-agent: |
Mutt/1.5.24 (2015-08-30) |
Hello, Eli.
On Sun, Mar 06, 2016 at 07:44:25PM +0200, Eli Zaretskii wrote:
> > Date: Sat, 5 Mar 2016 23:20:43 +0000
> > From: Alan Mackenzie <address@hidden>
> > Cc: address@hidden
> > On Sun, Mar 06, 2016 at 12:03:50AM +0100, Andreas Schwab wrote:
> > > Alan Mackenzie <address@hidden> writes:
> > > > On Sat, Mar 05, 2016 at 11:40:15PM +0100, Andreas Schwab wrote:
> > > >> Alan Mackenzie <address@hidden> writes:
> > > >> > How does one correctly create a buffer local variable in C? What I
> > > >> > have
> > > >> > at the moment is:
> > > >> > DEFSYM (Qcomment_depth_hwm, "comment-depth-hwm");
> > > >> > DEFVAR_LISP ("comment-depth-hwm", Vcomment_depth_hwm,
> > > >> > doc: /* Buffer position below which the
> > > >> > `comment-depth' property is valid. */);
> > > >> > Vcomment_depth_hwm = make_number (1);
> > > >> > Fmake_variable_buffer_local (Qcomment_depth_hwm);
> > > >> > This is clearly inadequate, of itself, to create a buffer local
> > > >> > variable.
> > > >> In which way?
> > > > Until a `setq' (or the like) is done on the variable for a particular
> > > > buffer, C code reading/writing from Vcomment_depth_hwm reads and writes
> > > > the same piece of RAM that all other buffers do.
> > > That seems to work for deactivate-mark.
> > It's not working for comment-depth-hwm.
> > Perhaps somebody who understands this will chip in, here. It could
> > really do with being in the Elisp manual.
> Is there still a problem?
No, I solved it by putting the variable into buffer.c, accessed via BVAR.
I'm still not sure if this is the canonical way to create a buffer local
variable accessed from C.
> If so, please describe the details, because I don't think I understand
> them well enough to try helping you. (Yes, I've read what you wrote,
> but your description was too general and didn't include any code you
> tried to use, so I'm not sure what exactly did you try and how.)
The problem was assigning a value to Vcomment_depth_hwm in C didn't
create a buffer local copy of `comment-depth-hwm'. Why should it?
I think the time it took me to find the solution is a problem. A 2003
copy of the XEmacs internals manual was helpful. ;-)
--
Alan Mackenzie (Nuremberg, Germany).
- How do I tell when the current buffer is the minibuffer?, Alan Mackenzie, 2016/03/05
- Re: How do I tell when the current buffer is the minibuffer?, raman, 2016/03/05
- Re: How do I tell when the current buffer is the minibuffer?, Andreas Schwab, 2016/03/05
- Re: How do I tell when the current buffer is the minibuffer?, Alan Mackenzie, 2016/03/05
- Re: How do I tell when the current buffer is the minibuffer?, Andreas Schwab, 2016/03/05
- Re: How do I tell when the current buffer is the minibuffer?, Alan Mackenzie, 2016/03/05
- Re: How do I tell when the current buffer is the minibuffer?, Andreas Schwab, 2016/03/05
- Re: How do I tell when the current buffer is the minibuffer?, Alan Mackenzie, 2016/03/05
- Re: How do I tell when the current buffer is the minibuffer?, Eli Zaretskii, 2016/03/06
- Re: How do I tell when the current buffer is the minibuffer?,
Alan Mackenzie <=
- Re: How do I tell when the current buffer is the minibuffer?, Stefan Monnier, 2016/03/08
- Re: How do I tell when the current buffer is the minibuffer?, Johan Bockgård, 2016/03/06