From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 27 17:06:40 2012 Received: (at submit) by debbugs.gnu.org; 27 Sep 2012 21:06:40 +0000 Received: from localhost ([127.0.0.1]:59351 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1THLI7-0006Om-E8 for submit@debbugs.gnu.org; Thu, 27 Sep 2012 17:06:40 -0400 Received: from eggs.gnu.org ([208.118.235.92]:47177) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1THKx6-0005uE-IP for submit@debbugs.gnu.org; Thu, 27 Sep 2012 16:44:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1THKww-0005T2-JX for submit@debbugs.gnu.org; Thu, 27 Sep 2012 16:44:50 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:36453) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1THKww-0005Sy-GV for submit@debbugs.gnu.org; Thu, 27 Sep 2012 16:44:46 -0400 Received: from eggs.gnu.org ([208.118.235.92]:53978) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1THKwv-0006Q8-B5 for bug-gnu-emacs@gnu.org; Thu, 27 Sep 2012 16:44:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1THKwu-0005Sm-1K for bug-gnu-emacs@gnu.org; Thu, 27 Sep 2012 16:44:45 -0400 Received: from mail-vc0-f169.google.com ([209.85.220.169]:53964) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1THKwt-0005Si-TR for bug-gnu-emacs@gnu.org; Thu, 27 Sep 2012 16:44:43 -0400 Received: by vcbfl17 with SMTP id fl17so2874769vcb.0 for ; Thu, 27 Sep 2012 13:44:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type :x-gm-message-state; bh=Hwq/TW5ceEi7yIpb1aSMQdBjws8eCLl0PGBviFK5zwU=; b=cjTOHs4FOl0DJYV2fsoU01qZJWAiYgtJvnaA7t2//aC2Rqa0DHUSTOptjnUhkI/n84 O/AHwIfkE+Y9PqkAaAUYRLcPKZZIoGgIKAXr00x0yrTavwABzKCoO8JJQgpRak/TlYXG kwZkKvz15lO9EXvQ7Hsg6xlVNCVtHHirNsWy771UHhH8Kv9GNmm0eNO69NejuPjXocEE SJdGedPpQ22O4z1vjZRGPgA1OApRkqbt8YP85VdlGmp81RB1DJ+NleoR5sFzBdCqlJ6X J3rGt/c+koGC8pvimPWFuspw6E+x8BZLjyUX5vDXFQ14unzvxQhKdxLPj+VuXxZGz3KH dlhQ== Received: by 10.52.67.44 with SMTP id k12mr1040609vdt.15.1348778682369; Thu, 27 Sep 2012 13:44:42 -0700 (PDT) MIME-Version: 1.0 Received: by 10.58.168.144 with HTTP; Thu, 27 Sep 2012 13:44:22 -0700 (PDT) From: Changa Imara Date: Thu, 27 Sep 2012 13:44:22 -0700 Message-ID: Subject: 24.2; Emacs fails to use lexical-binding when run from script or in file-local variable list To: bug-gnu-emacs@gnu.org Content-Type: text/plain; charset=ISO-8859-1 X-Gm-Message-State: ALoCoQlRlHXmGue2nNzeJCWQYTc3QQrz1w4abUxgehL0Cuvct0uSxYLbQZ/ZksnXY2ewf3RuQSJj X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 208.118.235.17 X-Spam-Score: -6.9 (------) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Thu, 27 Sep 2012 17:06:38 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) I'm attempting to run the following script: ===start script=== #!/usr/local/bin/emacs --script ;;; -*- lexical-binding: t -*- (defun foo () (setq x 100)) (defun bar () (let ((x 0)) (foo) x)) (message "%d" (bar)) ; would expect x to still be 0 here ===end script=== With lexical binding enabled the script should return 0. Otherwise it will return 100. However, when set to be executable and run from the shell with a command like "./lexical-binding-test.el", emacs fails to use lexial-binding. According to the manual: "In shell scripts, the first line is used to identify the script interpreter, so you cannot put any local variables there. To accommodate this, Emacs looks for local variable specifications in the second line if the first line specifies an interpreter. " This does not seem to be the case. I also tried setting lexical-bindings using a file local variable list. This doesn't seem to work either. In GNU Emacs 24.2.1 (x86_64-apple-darwin, NS apple-appkit-1038.36) of 2012-08-27 on bob.porkrind.org Windowing system distributor `Apple', version 10.3.1138 Configured using: `configure '--host=x86_64-apple-darwin' '--build=i686-apple-darwin' '--with-ns' 'build_alias=i686-apple-darwin' 'host_alias=x86_64-apple-darwin' 'CC=gcc -mmacosx-version-min=10.5'' Important settings: value of $LC_ALL: nil value of $LC_COLLATE: nil value of $LC_CTYPE: nil value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: nil value of $LANG: nil value of $XMODIFIERS: nil locale-coding-system: nil default enable-multibyte-characters: t Major mode: Emacs-Lisp Minor modes in effect: shell-dirtrack-mode: t hi-lock-mode: t recentf-mode: t eldoc-mode: t elisp-slime-nav-mode: t paredit-mode: t hl-line-mode: t idle-highlight-mode: t ido-ubiquitous-mode: t show-paren-mode: t global-linum-mode: t linum-mode: t mouse-wheel-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t column-number-mode: t line-number-mode: t transient-mark-mode: t Features: (shadow sort flyspell ispell mail-extr emacsbug message rfc822 mml mml-sec mm-decode mm-bodies mm-encode mailabbrev gmm-utils mailheader sendmail tramp-cache tramp tramp-compat format-spec tramp-loaddefs debug shell pcomplete comint regexp-opt ansi-color pp lisp-mnt misearch multi-isearch mule-util parse-time mail-utils network-stream starttls url-cache url-http tls mail-parse rfc2231 rfc2047 rfc2045 ietf-drums url-gw url-auth url url-proxy url-privacy url-expand url-methods url-history url-cookie url-util url-parse auth-source eieio byte-opt bytecomp byte-compile cconv macroexp assoc gnus-util password-cache url-vars mm-util mail-prsvr mailcap finder-inf hi-lock newcomment files-x recentf tree-widget wid-edit eldoc elisp-slime-nav etags ring paredit hl-line saveplace idle-highlight-mode thingatpt yasnippet help-mode view cl htmlize-autoloads starter-kit-lisp-autoloads elisp-slime-nav-autoloads starter-kit-autoloads edmacro kmacro smex starter-kit-misc ido-ubiquitous ido paren starter-kit-defuns uniquify advice help-fns advice-preload magit-autoloads info easymenu ido-ubiquitous-autoloads smex-autoloads find-file-in-project-autoloads idle-highlight-mode-autoloads paredit-autoloads yasnippet-autoloads package tabulated-list linum time-date tooltip ediff-hook vc-hooks lisp-float-type mwheel ns-win tool-bar dnd fontset image fringe lisp-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces cus-face files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote make-network-process ns multi-tty emacs) From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 27 17:19:26 2012 Received: (at 12528) by debbugs.gnu.org; 27 Sep 2012 21:19:26 +0000 Received: from localhost ([127.0.0.1]:59365 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1THLUT-0006hA-S8 for submit@debbugs.gnu.org; Thu, 27 Sep 2012 17:19:26 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:56208) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1THLUR-0006h2-8T for 12528@debbugs.gnu.org; Thu, 27 Sep 2012 17:19:24 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1THLUK-0002E0-Bw; Thu, 27 Sep 2012 17:19:16 -0400 From: Glenn Morris To: Changa Imara Subject: Re: bug#12528: 24.2; Emacs fails to use lexical-binding when run from script or in file-local variable list References: X-Spook: Al Jazeera electronic surveillance BLU-97 A/B Montenegro X-Ran: vzM:>mZz][A3izhwh8C,3=iKc6DhJpos\n]at^7'2~dcLB?tB{_o\5ZmWAVKZ@$uyEO0d~ X-Hue: red X-Debbugs-No-Ack: yes X-Attribution: GM Date: Thu, 27 Sep 2012 17:19:16 -0400 In-Reply-To: (Changa Imara's message of "Thu, 27 Sep 2012 13:44:22 -0700") Message-ID: User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -7.7 (-------) X-Debbugs-Envelope-To: 12528 Cc: 12528@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -7.7 (-------) lexical-binding is not a normal file local variable and literally must be on the first line of the file (bug#10605). This is documented, but I guess nobody thought about Emacs scripts till now. There is no way to make that work at present AFAICS. From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 27 17:22:54 2012 Received: (at 12528) by debbugs.gnu.org; 27 Sep 2012 21:22:54 +0000 Received: from localhost ([127.0.0.1]:59369 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1THLXq-0006mh-AK for submit@debbugs.gnu.org; Thu, 27 Sep 2012 17:22:54 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:56397) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1THLXo-0006mZ-Ks for 12528@debbugs.gnu.org; Thu, 27 Sep 2012 17:22:53 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1THLXi-0002cE-2f; Thu, 27 Sep 2012 17:22:46 -0400 From: Glenn Morris To: Changa Imara Subject: Re: bug#12528: 24.2; Emacs fails to use lexical-binding when run from script or in file-local variable list References: X-Spook: bce Israel United Nations investigation SSL Clinton X-Ran: ^/g,L%Jpf(lAul^B[b^#RO15ZSXK#kY}_XPIb":kT<5\~wVmYS#/uYG$e)(3._#ytfK]&P X-Hue: blue X-Debbugs-No-Ack: yes X-Attribution: GM Date: Thu, 27 Sep 2012 17:22:45 -0400 In-Reply-To: (Glenn Morris's message of "Thu, 27 Sep 2012 17:19:16 -0400") Message-ID: User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -7.7 (-------) X-Debbugs-Envelope-To: 12528 Cc: 12528@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -7.7 (-------) Glenn Morris wrote: > lexical-binding is not a normal file local variable and literally must > be on the first line of the file (bug#10605). This is documented, but > I guess nobody thought about Emacs scripts till now. There is no way to > make that work at present AFAICS. Without changing Emacs, I mean. From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 28 03:42:07 2012 Received: (at 12528-done) by debbugs.gnu.org; 28 Sep 2012 07:42:08 +0000 Received: from localhost ([127.0.0.1]:59719 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1THVD4-0004x1-AD for submit@debbugs.gnu.org; Fri, 28 Sep 2012 03:42:07 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:44390) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1THVD0-0004ws-Pr for 12528-done@debbugs.gnu.org; Fri, 28 Sep 2012 03:42:03 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1THVCr-00080h-1q; Fri, 28 Sep 2012 03:41:53 -0400 From: Glenn Morris To: 12528-done@debbugs.gnu.org Subject: Re: bug#12528: 24.2; Emacs fails to use lexical-binding when run from script or in file-local variable list References: X-Spook: clandestine Bellcore military quarter Telex ANZUS clones X-Ran: Gfv)5@og-lOqzel%4!r*n2i3zZYYXBdY4&c/X2::D`BRZA=9VWMl'HCVWdRs-L1y$"8Um_ X-Hue: magenta X-Attribution: GM Date: Fri, 28 Sep 2012 03:41:52 -0400 In-Reply-To: (Glenn Morris's message of "Thu, 27 Sep 2012 17:22:45 -0400") Message-ID: User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -7.7 (-------) X-Debbugs-Envelope-To: 12528-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -7.7 (-------) Version: 24.3 Installed something to trunk that hopefully fixes this. From unknown Sat Sep 13 13:15:34 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 26 Oct 2012 11:24:03 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator