From: "Gauthier Östervall" <gauthier@ostervall.se>
To: Stefan Monnier <monnier@iro.umontreal.ca>, help-gnu-emacs@gnu.org
Subject: Re: sending function arguments to recursive function calls
Date: Sun, 12 May 2013 15:19:09 +0200 [thread overview]
Message-ID: <CAM8gEggb2Rr4Ba9K5GGjNw-c_pJHLTLuutrQ=sYMQJSpPq_chA@mail.gmail.com> (raw)
In-Reply-To: <jwvzjw49wh0.fsf-monnier+INBOX@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 1170 bytes --]
On Wed, May 8, 2013 at 2:21 PM, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
> When lexical-binding is t, they're very good roomates already.
> Hopefully with time, the "lexical-binding = nil" case can be dropped.
Does this imply that if I want to give for example window.el
lexical-binding (I do have an ulterior motive), no one would mind
having it that way?
> [...] But converting existing dynamically scoped code to lexical scoping
> is usually pretty easy: set lexical-binding to t at the top of the file,
> then byte-compile it, then fix the warnings, and you should be good to go.
>
> Sometimes there's some extra tricks undetected by the simple checks
> performed by the byte-compiler, so it doesn't always work as smoothly,
> but in most cases it's really a straightforward process.
I have tried to do just that to window.el. It seemed indeed
straightforward to me, but I would greatly appreciate feedback on the
change. I really just added the lexical-binding at the top, and
removed seemingly unused variables. I don't know why these variables
were left (were they really unused?), but byte-compiling gives no
warning, at least.
See attached bundle.
[-- Attachment #2: make-window-lexical.txt --]
[-- Type: text/plain, Size: 4466 bytes --]
# Bazaar merge directive format 2 (Bazaar 0.90)
# revision_id: gauthier@ostervall.se-20130512130720-hpthrwn048nrj4ao
# target_branch: file:///media/sf_prog/emacs/trunk/
# testament_sha1: 288aa595c17d0d7923aa72d1cbe25a3a3b081380
# timestamp: 2013-05-12 15:09:54 +0200
# base_revision_id: rgm@gnu.org-20130430101735-ccy06l3ndx4vrj18
#
# Begin patch
=== modified file 'lisp/window.el' (properties changed: -x to +x)
--- lisp/window.el 2013-04-13 14:37:20 +0000
+++ lisp/window.el 2013-05-12 13:07:20 +0000
@@ -1,4 +1,4 @@
-;;; window.el --- GNU Emacs window commands aside from those written in C
+;;; window.el --- GNU Emacs window commands aside from those written in C -*- lexical-binding: t -*-
;; Copyright (C) 1985, 1989, 1992-1994, 2000-2013 Free Software
;; Foundation, Inc.
@@ -685,11 +685,9 @@
This function may be called only if no window on SIDE exists yet.
The new window automatically becomes the \"major\" side window on
SIDE. Return the new window, nil if its creation window failed."
- (let* ((root (frame-root-window))
- (left-or-right (memq side '(left right)))
+ (let* ((left-or-right (memq side '(left right)))
(major (window--major-side-window side))
- (selected-window (selected-window))
- (on-side (cond
+ (on-side (cond
((eq side 'top) 'above)
((eq side 'bottom) 'below)
(t side)))
@@ -698,8 +696,7 @@
;; parent window unless needed.
(window-combination-resize 'side)
(window-combination-limit nil)
- (new (split-window major nil on-side))
- fun)
+ (new (split-window major nil on-side)))
(when new
;; Initialize `window-side' parameter of new window to SIDE.
(set-window-parameter new 'window-side side)
@@ -749,8 +746,7 @@
A positive value means use a slot following (that is, below or
on the right of) the middle slot. The default is zero."
(let ((side (or (cdr (assq 'side alist)) 'bottom))
- (slot (or (cdr (assq 'slot alist)) 0))
- new)
+ (slot (or (cdr (assq 'slot alist)) 0)))
(cond
((not (memq side '(top bottom left right)))
(error "Invalid side %s specified" side))
@@ -776,9 +772,8 @@
((eq side 'right) 2)
((eq side 'bottom) 3))
window-sides-slots))
- (selected-window (selected-window))
- window this-window this-slot prev-window next-window
- best-window best-slot abs-slot new-window)
+ window this-window this-slot prev-window next-window
+ best-window best-slot abs-slot)
(cond
((and (numberp max-slots) (<= max-slots 0))
@@ -5713,7 +5708,7 @@
0)
(display-buffer-reuse-frames 0)
(t (last-nonminibuffer-frame))))
- entry best-window second-best-window window)
+ best-window second-best-window window)
;; Scan windows whether they have shown the buffer recently.
(catch 'best
(dolist (window (window-list-1 (frame-first-window) 'nomini frames))
# Begin bundle
IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWedecm4AAeVfgAaQUPP//1qB
kgC////wU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w89miN4XHQOaw1yhBBu2GoM5Lc6koJOHBTCEAkYteO2gv4Wb2QY/O1FvargvWmfQyvt
uugcaqGNdQ9Kx2knbaJqmo7khIf6KHlbVUubzXyFYiTKi0QXPKLIsHbcSttdQO0iX3n0C9UWuC5e
KW1Gnu6AG98drMnJa5drdc52iqydVSlG7mcQwc4Its5WlSgpV9NNXDwWUVWRadWTLKTAYidX749+
LPZof+T2pS1pymOSJM5uIonFA7avZlGmEGRIBN/QAQCqIetAnNkpmqUfBqMTlExi97swFDvkA67h
Ty8riYUCDK03J1pupXHbQDD0oBX5rNNVBUoOyS1lTB9mddvNoWC4qV69zKwGYJK5Tuzkv/F3JFOF
CQ515ybg
next prev parent reply other threads:[~2013-05-12 13:19 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-04 13:01 sending function arguments to recursive function calls Gauthier Östervall
2013-05-04 15:30 ` Drew Adams
2013-05-07 11:25 ` Gauthier Östervall
2013-05-07 14:04 ` Drew Adams
2013-05-08 12:21 ` Stefan Monnier
2013-05-09 8:35 ` Gauthier Östervall
2013-05-09 12:23 ` Stefan Monnier
2013-05-12 13:19 ` Gauthier Östervall [this message]
2013-05-13 14:55 ` Stefan Monnier
2013-05-17 12:20 ` Gauthier Östervall
2013-05-17 12:26 ` Dmitry Gutov
2013-05-17 14:31 ` Drew Adams
2013-05-19 16:57 ` Dmitry Gutov
2013-05-21 16:34 ` Drew Adams
[not found] ` <mailman.70.1368982677.22516.help-gnu-emacs@gnu.org>
2013-05-19 20:59 ` Pascal J. Bourguignon
2013-05-20 19:31 ` Dmitry Gutov
[not found] ` <mailman.94.1369078320.22516.help-gnu-emacs@gnu.org>
2013-05-20 19:55 ` Pascal J. Bourguignon
2013-05-07 14:32 ` Pascal J. Bourguignon
[not found] ` <mailman.25279.1367935468.855.help-gnu-emacs@gnu.org>
2013-05-07 14:55 ` Pascal J. Bourguignon
2013-05-08 12:25 ` Stefan Monnier
2013-05-05 1:22 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAM8gEggb2Rr4Ba9K5GGjNw-c_pJHLTLuutrQ=sYMQJSpPq_chA@mail.gmail.com' \
--to=gauthier@ostervall.se \
--cc=help-gnu-emacs@gnu.org \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).