From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: DocView AutoFitting via "doc-view-autofit-mode" Date: Wed, 25 Apr 2012 23:19:13 -0400 Message-ID: References: <4F764EBB.5030102@googlemail.com> <87sjgnbxth.fsf@thinkpad.tsdh.de> <4F79E8D5.8080701@googlemail.com> <4F7AFD5D.3030809@googlemail.com> <4F7B130C.5040405@googlemail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1335410362 4119 80.91.229.3 (26 Apr 2012 03:19:22 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 26 Apr 2012 03:19:22 +0000 (UTC) Cc: Tassilo Horn , emacs-devel@gnu.org To: Moritz Maxeiner Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Apr 26 05:19:21 2012 Return-path: Envelope-to: ged-emacs-devel@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 1SNFEn-0001dM-9w for ged-emacs-devel@m.gmane.org; Thu, 26 Apr 2012 05:19:21 +0200 Original-Received: from localhost ([::1]:51811 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SNFEm-0005PM-KD for ged-emacs-devel@m.gmane.org; Wed, 25 Apr 2012 23:19:20 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:42411) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SNFEk-0005PH-BS for emacs-devel@gnu.org; Wed, 25 Apr 2012 23:19:19 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SNFEi-0000ML-DF for emacs-devel@gnu.org; Wed, 25 Apr 2012 23:19:17 -0400 Original-Received: from ironport-out.teksavvy.com ([206.248.143.162]:38335) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SNFEi-0000G9-5Y for emacs-devel@gnu.org; Wed, 25 Apr 2012 23:19:16 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApYIACxOgk/O+LN8/2dsb2JhbABDuCMDgQyBCIIJAQEEAVYjBQsLNBIUGA0kE4gJBbYyglSJDYR5BKRFgV2DAw X-IronPort-AV: E=Sophos;i="4.75,391,1330923600"; d="scan'208";a="176743760" Original-Received: from 206-248-179-124.dsl.teksavvy.com (HELO pastel.home) ([206.248.179.124]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 25 Apr 2012 23:19:14 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id C835B58FE4; Wed, 25 Apr 2012 23:19:13 -0400 (EDT) In-Reply-To: (Stefan Monnier's message of "Tue, 03 Apr 2012 12:14:06 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.143.162 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:150038 Archived-At: >>>>> "Stefan" == Stefan Monnier writes: >> Hm, I seem to have expressed myself a bit poorly, >> so let me clear it up: >>> ;;; foo.el --- Foo -*- lexical-binding: t -*- >>> >>> (defun foo (window) >>> (message "%s" window)) >>> >>> (defun bar () >>> (interactive) >>> (lexical-let ((foobar (selected-window))) >>> (foo foobar))) > Ah, thanks, I understand now. Sorry, for reading your earlier message > without enough care. So the problem has nothing to do with "named > functions". You can just use > (lexical-let ((foobar (selected-window))) > (message "hello %s" foobar)) > in a lexical-binding buffer to reproduce the problem. Indeed, it seems > that lexical-let doesn't work with lexical-binding. Not a big deal, but > we should at least try to signal it in a way that's less cryptic. I've just installed the patch below in the trunk, which fixes the problem. Stefan --- lisp/emacs-lisp/cl-macs.el 2012-01-19 07:21:25 +0000 +++ lisp/emacs-lisp/cl-macs.el 2012-04-26 01:25:25 +0000 @@ -1488,13 +1488,19 @@ (list '(defun . cl-defun-expander)) cl-macro-environment)))) (if (not (get (car (last cl-closure-vars)) 'used)) - (list 'let (mapcar (function (lambda (x) - (list (caddr x) (cadr x)))) vars) - (sublis (mapcar (function (lambda (x) + ;; Turn (let ((foo (gensym))) (set foo ) ...(symbol-value foo)...) + ;; into (let ((foo )) ...(symbol-value 'foo)...). + ;; This is good because it's more efficient but it only works with + ;; dynamic scoping, since with lexical scoping we'd need + ;; (let ((foo )) ...foo...). + `(progn + ,@(mapcar (lambda (x) `(defvar ,(caddr x))) vars) + (let ,(mapcar (lambda (x) (list (caddr x) (cadr x))) vars) + ,(sublis (mapcar (lambda (x) (cons (caddr x) - (list 'quote (caddr x))))) + (list 'quote (caddr x)))) vars) - ebody)) + ebody))) (list 'let (mapcar (function (lambda (x) (list (caddr x) (list 'make-symbol