From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: How do I tell when the current buffer is the minibuffer? Date: Sat, 5 Mar 2016 22:51:26 +0000 Message-ID: <20160305225126.GC26757@acm.fritz.box> References: <20160305210248.GA26757@acm.fritz.box> <87lh5w37jq.fsf@linux-m68k.org> <20160305221914.GB26757@acm.fritz.box> <87h9gk35ww.fsf@linux-m68k.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1457218152 1789 80.91.229.3 (5 Mar 2016 22:49:12 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 5 Mar 2016 22:49:12 +0000 (UTC) Cc: emacs-devel@gnu.org To: Andreas Schwab Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Mar 05 23:49:04 2016 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 1acL0R-00019p-CP for ged-emacs-devel@m.gmane.org; Sat, 05 Mar 2016 23:49:03 +0100 Original-Received: from localhost ([::1]:48273 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1acL0Q-0002HA-JF for ged-emacs-devel@m.gmane.org; Sat, 05 Mar 2016 17:49:02 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60354) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1acL0N-0002H0-D3 for emacs-devel@gnu.org; Sat, 05 Mar 2016 17:49:00 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1acL0K-0002Pl-3N for emacs-devel@gnu.org; Sat, 05 Mar 2016 17:48:59 -0500 Original-Received: from mail.muc.de ([193.149.48.3]:27184) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1acL0J-0002Pg-Qg for emacs-devel@gnu.org; Sat, 05 Mar 2016 17:48:56 -0500 Original-Received: (qmail 65553 invoked by uid 3782); 5 Mar 2016 22:48:53 -0000 Original-Received: from acm.muc.de (p579E8370.dip0.t-ipconnect.de [87.158.131.112]) by colin.muc.de (tmda-ofmipd) with ESMTP; Sat, 05 Mar 2016 23:48:52 +0100 Original-Received: (qmail 28824 invoked by uid 1000); 5 Mar 2016 22:51:26 -0000 Content-Disposition: inline In-Reply-To: <87h9gk35ww.fsf@linux-m68k.org> User-Agent: Mutt/1.5.24 (2015-08-30) X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x X-Received-From: 193.149.48.3 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:200978 Archived-At: Hello, Andreas. On Sat, Mar 05, 2016 at 11:40:15PM +0100, Andreas Schwab wrote: > Alan Mackenzie 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. In the mean time, I've been looking around, and it might well be that the correct way to create a buffer local variable in C is to use the macro DEFVAR_PER_BUFFER in buffer.c. It's doesn't seem documented (outside of buffer.c), though. > Andreas. > -- > Andreas Schwab, schwab@linux-m68k.org > GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 > "And now for something completely different." -- Alan Mackenzie (Nuremberg, Germany).