emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: DocView AutoFitting via "doc-view-autofit-mode"


From: Moritz Maxeiner
Subject: Re: DocView AutoFitting via "doc-view-autofit-mode"
Date: Tue, 03 Apr 2012 17:11:08 +0200
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/20120327 Thunderbird/11.0.1

Hm, I seem to have expressed myself a bit poorly,
so let me clear it up:

Obviously, named functions are used all over the place with
lexical-binding, so they do work in many circumstances.

I know that and what I wrote was not meant to contradict it, because
you write about general, I wrote about inside lexical-binding enabled files
where lexical-let and let should be the same (since lexical binding is already
enabled).

using
`lexical-let' inside a lexical binding enabled file produces tons of "bad lexing"
errors when used with named functions

To clarify, I wrote nothing about `lexical-let' in general, I wrote that using it inside a lexical binding enabled file (meaning with the "lexical-binding: t" header)
together with a named function would produce errors.
You can try it out for yourself with the code I send in the same mail you refer to:

;;; foo.el --- Foo -*- lexical-binding: t -*-

(defun foo (window)
  (message "%s" window))

(defun bar ()
  (interactive)
  (lexical-let ((foobar (selected-window)))
    (foo foobar)))

Switch to an empty buffer, paste it and then do `M-x eval-buffer' `M-x bar'
and you'll get a [bad-lexical-ref] error.
Remove the header ( the ;;; foo.el line), do `M-x eval-buffer' `M-x bar'
again and you won't get an error, but a message with the selected window.

If you use a lambda inside the defun of bar instead of foo, it will work with and without lexical-binding enabled. And this difference is what I simply don't understand.

Now, since I had no idea why the function `lexical-let' would behave differently (if it didn't there should be either an error with AND without the header, or
both should work fine), could not find any clues in info/manual/docstring
and more, why it doesn't work, I wrote that.

Moritz



reply via email to

[Prev in Thread] Current Thread [Next in Thread]