From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Philipp Stephani Newsgroups: gmane.emacs.help Subject: Re: The two-argument form of defvar Date: Sat, 18 Apr 2015 09:25:06 +0000 Message-ID: References: <87vbhxf2s6.fsf@yahoo.fr> <87mw396l2s.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1429349122 3323 80.91.229.3 (18 Apr 2015 09:25:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 18 Apr 2015 09:25:22 +0000 (UTC) To: Nicolas Richard , "help-gnu-emacs@gnu.org" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Apr 18 11:25:20 2015 Return-path: Envelope-to: geh-help-gnu-emacs@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 1YjP04-0005y1-5r for geh-help-gnu-emacs@m.gmane.org; Sat, 18 Apr 2015 11:25:20 +0200 Original-Received: from localhost ([::1]:45030 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YjP03-0005EU-Cp for geh-help-gnu-emacs@m.gmane.org; Sat, 18 Apr 2015 05:25:19 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51466) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YjOzs-0005Dy-Qy for help-gnu-emacs@gnu.org; Sat, 18 Apr 2015 05:25:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YjOzr-0000eZ-R9 for help-gnu-emacs@gnu.org; Sat, 18 Apr 2015 05:25:08 -0400 Original-Received: from mail-wg0-x22d.google.com ([2a00:1450:400c:c00::22d]:34957) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YjOzr-0000eA-JM for help-gnu-emacs@gnu.org; Sat, 18 Apr 2015 05:25:07 -0400 Original-Received: by wgyo15 with SMTP id o15so134505288wgy.2 for ; Sat, 18 Apr 2015 02:25:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :content-type; bh=E4zWgt2yJpc9LjyrHIQV9kYlFtRMBmgTjNNlpZQ59Rg=; b=AGQ9D5XB9ndt0t1BzROYs4eCxBlqRfEuCU3OfPLgUNWbigo0Kzn5OlF/790tgyo6LC 8OWlPGVzvfz/VpEuoGhIL5OttkTPtPkLM3lpdhoFpdosg7ESZqly22reEyyeLW06Y6v2 VoV5E4busUBgUBtTyzYL0J0AQT0IeNByLhxW3zQ/V603mTPUY0kspS2b56vJ5ecHkGLH PcFYXrvnok7Jt0eDDVEWWS4FHXHSVVbigs60/vIs5dc9sjMqNQ+BPanYwfdHe+x8USeQ M9xzmL6MB+pYGrtY2McTY/Mjy2DR6aEjdofLZ8TWsSWAi0mDAZ1zzqZbkzNk4fS/eh/c cQXQ== X-Received: by 10.180.97.7 with SMTP id dw7mr8359007wib.74.1429349106967; Sat, 18 Apr 2015 02:25:06 -0700 (PDT) In-Reply-To: <87mw396l2s.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c00::22d X-Content-Filtered-By: Mailman/MimeDel 2.1.14 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:103812 Archived-At: Maybe there should be a declare-variable function to forward-declare variables, parallel to declare-function. Tassilo Horn schrieb am Do., 19. M=C3=A4rz 2015 um 16:52 Uhr= : > Nicolas Richard writes: > > >> when looking at the source code of defvar it becomes clear that the > >> two-argument form > >> > >> (defvar foo) > >> > >> is a no-op. > > > > Not always a no-op. The source code has this comment : > > /* A simple (defvar foo) with lexical scoping does "nothing" except > > declare that var to be dynamically scoped *locally* (i.e. within > > the current file or let-block). */ > > > > To reflect the above comment, the docstring has : > > | The `defvar' form also declares the variable as "special", > > | so that it is always dynamically bound even if `lexical-binding' is t= . > > But it doesn't *define* anything. > > (defvar xxx1 1) ;; C-h v xxx1 works > (defvar xxx2) ;; C-h v xxx2 (No matches) > > That behavior is a bit unexpected when the docstring says "Define SYMBOL > as a variable, and return SYMBOL." > > Bye, > Tassilo >