From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Changa Imara Newsgroups: gmane.emacs.bugs Subject: bug#12528: 24.2; Emacs fails to use lexical-binding when run from script or in file-local variable list Date: Thu, 27 Sep 2012 13:44:22 -0700 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: ger.gmane.org 1348780023 23657 80.91.229.3 (27 Sep 2012 21:07:03 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 27 Sep 2012 21:07:03 +0000 (UTC) To: 12528@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Sep 27 23:07:08 2012 Return-path: Envelope-to: geb-bug-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 1THLIY-0002I5-PP for geb-bug-gnu-emacs@m.gmane.org; Thu, 27 Sep 2012 23:07:07 +0200 Original-Received: from localhost ([::1]:36515 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1THLIT-0004g1-Fc for geb-bug-gnu-emacs@m.gmane.org; Thu, 27 Sep 2012 17:07:01 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:34286) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1THLIQ-0004fL-3x for bug-gnu-emacs@gnu.org; Thu, 27 Sep 2012 17:06:59 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1THLIO-0005Lq-Ta for bug-gnu-emacs@gnu.org; Thu, 27 Sep 2012 17:06:58 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:49805) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1THLIO-0005Lj-QY for bug-gnu-emacs@gnu.org; Thu, 27 Sep 2012 17:06:56 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1THLIT-0006PS-UZ for bug-gnu-emacs@gnu.org; Thu, 27 Sep 2012 17:07:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Changa Imara Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 27 Sep 2012 21:07:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 12528 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.134878000024604 (code B ref -1); Thu, 27 Sep 2012 21:07:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 27 Sep 2012 21:06:40 +0000 Original-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 Original-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 Original-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 Original-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 Original-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 Original-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 Original-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 Original-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== Original-Received: by 10.52.67.44 with SMTP id k12mr1040609vdt.15.1348778682369; Thu, 27 Sep 2012 13:44:42 -0700 (PDT) Original-Received: by 10.58.168.144 with HTTP; Thu, 27 Sep 2012 13:44:22 -0700 (PDT) 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-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 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:64963 Archived-At: 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)