From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Robert Pluim Newsgroups: gmane.emacs.devel Subject: Re: Native line numbers landed on master Date: Tue, 08 Oct 2019 13:15:46 +0200 Message-ID: References: <834l4xbfmp.fsf@gnu.org> <87d0fgagjl.fsf@gnus.org> <20191001225254.mwjnxlynjdc3mz7y@Ergus> <83lfu389vn.fsf@gnu.org> <87ftk9v4kx.fsf@wavexx.thregr.org> <83wodl54yt.fsf@gnu.org> <87pnjchm7p.fsf@wavexx.thregr.org> <83pnj8zff9.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="213397"; mail-complaints-to="usenet@blaine.gmane.org" Cc: spacibba@aol.com, lekktu@gmail.com, stefan@marxist.se, emacs-devel@gnu.org, wavexx@thregr.org, larsi@gnus.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Oct 08 13:16:04 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.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iHnTH-000tJq-T6 for ged-emacs-devel@m.gmane.org; Tue, 08 Oct 2019 13:16:04 +0200 Original-Received: from localhost ([::1]:53774 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iHnTG-0002Zb-8t for ged-emacs-devel@m.gmane.org; Tue, 08 Oct 2019 07:16:02 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49542) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iHnT6-0002Y2-6R for emacs-devel@gnu.org; Tue, 08 Oct 2019 07:15:53 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iHnT5-0008Tj-3L for emacs-devel@gnu.org; Tue, 08 Oct 2019 07:15:52 -0400 Original-Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:32888) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iHnT4-0008TK-Ne; Tue, 08 Oct 2019 07:15:50 -0400 Original-Received: by mail-wr1-x434.google.com with SMTP id b9so18960805wrs.0; Tue, 08 Oct 2019 04:15:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :mime-version:content-transfer-encoding; bh=47bbYrP5cw9WPw0dkxslqZLuBRql/mMTHgRfhJSLe0Q=; b=debzWF2JeslqCXX8oOJHsMV2sju5f/nCmbRJYcQHMwn7yBEVg1tNRZns5WAEilBHRV FMisw1eVhdFOBzgQ3N5yxN6PqJpR7KU/JCS7cmFSGgK8Lla/4trbYOwZiclp001S1D0Y teY+Xwmccf+EL1efROgw90lFQ6/FQuVm8C7hcftvCqk1lW/QYOEPyOFHOfLrVc89Kxek 0FjPvnO4tFxsQYQSsIfi73Sigtyi6jJUl9+YdzEo6q1AaUDED157gODuuZBYHMHH7REx U7niXtXulHnth/SNEHpBJlNyVgKkaz2fIUdPfZQ8cj0KFujJjZyetdZpuutujZb9S61W kpLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:mime-version:content-transfer-encoding; bh=47bbYrP5cw9WPw0dkxslqZLuBRql/mMTHgRfhJSLe0Q=; b=c6uvDCtmmNVJd2yAHjUJoXrhVd1lqpwX23KV3sA7xp1RY3YZ/qD9CrvOxL+7iQTrxr FqQMztbYpKcgZNwmTCL4s1nTtBZfWKkTEgkHJW+XMv69QipPKSEo98YR++MCDQEYlFKz r/6Nfb7DjdJz9y73GYq7+DI+HOyyvtV/0u0LbpYfpY77HLjMQDN9faVNn5ddC/mpTLSP EJRrWLj4n8JsSy4r3nDh0oaHxh2+v2d4lIn2b3/+PI4nBbpAS06p/Fj6en7zNcIgkQ5f Vl8Cp3DE7bXFgPY4oC/KZDaqPZCFYbR4JyjlTn2tzM31dA39riI1R/sAbj+8IpFmsDwi dqdg== X-Gm-Message-State: APjAAAWA+R8K5iUslbkE1w0UYKgFh/O6gdM+zsItXQ/5ZKZMbr2N0mXq 9N+1BRahidU2Up/O3DkcNglGHkJ9hRE= X-Google-Smtp-Source: APXvYqzqhBiOcSRReK0zZKiNxqRULGDWfrlaK45jHwoa/t4qUWJx3cFMF3EFDSjWIXD5KswNAAunOA== X-Received: by 2002:a5d:5552:: with SMTP id g18mr4227276wrw.386.1570533348757; Tue, 08 Oct 2019 04:15:48 -0700 (PDT) Original-Received: from rpluim-mac ([149.5.228.1]) by smtp.gmail.com with ESMTPSA id d15sm7467006wru.50.2019.10.08.04.15.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2019 04:15:47 -0700 (PDT) In-Reply-To: <83pnj8zff9.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 07 Oct 2019 19:30:34 +0300") X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::434 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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:240743 Archived-At: >>>>> On Mon, 07 Oct 2019 19:30:34 +0300, Eli Zaretskii said: Eli> We have a node about writing Emacs Lisp primitives; a node about L= isp Eli> variables implemented in C still awaits its author. Patches are Eli> welcome. I don=CA=BCt know about a separate node. How about this: diff --git a/doc/lispref/internals.texi b/doc/lispref/internals.texi index c52999e1cd..54f1e8858d 100644 --- a/doc/lispref/internals.texi +++ b/doc/lispref/internals.texi @@ -945,7 +945,7 @@ Writing Emacs Primitives @anchor{Defining Lisp variables in C} @vindex byte-boolean-vars @cindex defining Lisp variables in C -@cindex @code{DEFVAR_INT}, @code{DEFVAR_LISP}, @code{DEFVAR_BOOL} +@cindex @code{DEFVAR_INT}, @code{DEFVAR_LISP}, @code{DEFVAR_BOOL}, @code{D= EFSYM} The function @code{syms_of_@var{filename}} is also the place to define any C variables that are to be visible as Lisp variables. @code{DEFVAR_LISP} makes a C variable of type @code{Lisp_Object} visible @@ -956,6 +956,38 @@ Writing Emacs Primitives defined with @code{DEFVAR_BOOL} are automatically added to the list @code{byte-boolean-vars} used by the byte compiler. =20 + These macros all expect three arguments: + +@table @code +@item lname +The Lisp-level name of the variable. +@item vname +The C-level name of the variable. +@item doc +The documentation for the variable, as a C comment. +@end table + + By convention, when defining variables of a ``native'' type +(@code{int} and @code{bool}), the name of the C variable is the same +as the name of the Lisp variable with ``-'' replaced by ``_''. When +the variable can hold any Lisp object, the convention is +to also prefix the C variable name with ``V''. i.e. + +@smallexample +DEFVAR_INT ("my-int-variable", my_int_variable, + doc: /* An integer variable. */); + +DEFVAR_LISP ("my-lisp-variable", Vmy_lisp_variable, + doc: /* A Lisp variable. */); +@end smallexample + +If you want to define a constant symbol rather than a variable, use +@code{DEFSYM} instead. e.g. + +@smallexample +DEFSYM ("Qmy_symbol", "my-symbol"); +@end smallexample + @cindex defining customization variables in C If you want to make a Lisp variable that is defined in C behave like one declared with @code{defcustom}, add an appropriate entry to