From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Keith David Bershatsky Newsgroups: gmane.emacs.devel Subject: Re: buffer.c/buffer.h: How to add new buffer-local variables? Date: Sun, 31 Mar 2019 09:32:35 -0700 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="10601"; mail-complaints-to="usenet@blaine.gmane.org" Cc: Eli Zaretskii , Andreas Schwab , emacs-devel@gnu.org To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Mar 31 18:32:47 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hAdO2-0002e2-Jo for ged-emacs-devel@m.gmane.org; Sun, 31 Mar 2019 18:32:47 +0200 Original-Received: from localhost ([127.0.0.1]:38513 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hAdO1-0004Jw-Kd for ged-emacs-devel@m.gmane.org; Sun, 31 Mar 2019 12:32:45 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:36301) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hAdNv-0004Jr-6p for emacs-devel@gnu.org; Sun, 31 Mar 2019 12:32:40 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hAdNu-0006ej-1G for emacs-devel@gnu.org; Sun, 31 Mar 2019 12:32:39 -0400 Original-Received: from gateway23.websitewelcome.com ([192.185.50.107]:24617) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hAdNt-0006e8-JZ for emacs-devel@gnu.org; Sun, 31 Mar 2019 12:32:37 -0400 Original-Received: from cm13.websitewelcome.com (cm13.websitewelcome.com [100.42.49.6]) by gateway23.websitewelcome.com (Postfix) with ESMTP id 94E89112F9 for ; Sun, 31 Mar 2019 11:32:36 -0500 (CDT) Original-Received: from gator3053.hostgator.com ([50.87.144.69]) by cmsmtp with SMTP id AdNshCkFQYTGMAdNshNMRV; Sun, 31 Mar 2019 11:32:36 -0500 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lawlist.com ; s=default; h=Content-Type:MIME-Version:Subject:Cc:To:From:Message-ID:Date: Sender:Reply-To:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=NLqk+UyGKD/hXoSLke2lrFV+u9Rjmc8ttxHJ5+Hoec4=; b=Ofs3UMiRugszNsS5OqcQKyCTac 4Chlm+TVu3VyhOmdhKGpzGeScIRHQB0KWQLkyYTDlcUPE2O2XV7n6gShZc8vRDfRgshKJk9sJzuM+ pEmyeSkCrCvwiFGJtxYp3N7lFKRJD9j3chmM7cj+IGBeoC71Y1ilyreV6N9ZWkK7YlGbikk3PQzqp d/xBoe58IPgRHZjxguRlkrBWXfn/i03NLuFJ91IiA9IVNn6ju1cVZ180/mPI7xn/mvKbB7XYCLaTy rcCC7R78tgc+P656CFZmClTpclEvFPI5zFmbkrZjHTrImRnl3nrZL+qdH9iDJgRPshS8SMmVoh4LY SC7HMFqw==; Original-Received: from cpe-45-48-239-195.socal.res.rr.com ([45.48.239.195]:49523 helo=server.local) by gator3053.hostgator.com with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.91) (envelope-from ) id 1hAdNr-001rXO-MX; Sun, 31 Mar 2019 11:32:35 -0500 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator3053.hostgator.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lawlist.com X-BWhitelist: no X-Source-IP: 45.48.239.195 X-Source-L: No X-Exim-ID: 1hAdNr-001rXO-MX X-Source-Sender: cpe-45-48-239-195.socal.res.rr.com (server.local) [45.48.239.195]:49523 X-Source-Auth: lawlist X-Email-Count: 3 X-Source-Cap: bGF3bGlzdDtsYXdsaXN0O2dhdG9yMzA1My5ob3N0Z2F0b3IuY29t X-Local-Domain: yes X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 192.185.50.107 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:234841 Archived-At: Thank you, Alan. I was unaware that there are other means of declaring buffer-local variables in C. In a few areas of the code for the features that I am working on, I have statements such as: if (!NILP (BVAR (XBUFFER (w->contents), crosshairs))) ... I have been using the existing method in buffer.c/h to define buffer local variables for the past three years (while chiseling away at the multiple fake cursors feature). The last proof concept patch applied to an Emacs version from 12/13/2018, and I am just about ready to submit a new proof concept patch for a current version of Emacs. If there is a way to increase the maximum number of buffer local variables to continue using the same method as is done in buffer.c/h, then I would prefer to do that. If not, then the method you suggested below could be fallback plan. Other than personal preference and my existing code that has worked well up until recently, there is no pressing reason that it has to be done a certain way. Keith ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; > Date: [03-31-2019 05:22:38] <31 Mar 2019 12:22:38 +0000> > From: Alan Mackenzie > > You're surely aware that you can add a new local variable in C source by > declaring it with DEFVAR, then calling Fmake_variable_buffer_local in > syms_of_foo? Or something like that (I've forgotten the exact details). > > Is there some pressing reason why the new variable has to be part of > struct buffer rather than an "ordinary" buffer local? > > It's worth noting that there's nothing in the elisp manual about how to > create buffer local variables in the C source. > > It may be that there're BL variables in struct buffer that don't really > need to be there, and could be converted to "ordinary" variables. I > think I might have added one or two of these myself, but don't remember.