From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Dieter Deyke Newsgroups: gmane.emacs.devel Subject: [PATCH] elpa/packages/sokoban/sokoban.el Date: Thu, 07 Feb 2019 11:51:56 +0100 Message-ID: <87zhr7zx9v.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="137944"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Feb 07 11:52:19 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1grhI3-000ZlZ-I4 for ged-emacs-devel@m.gmane.org; Thu, 07 Feb 2019 11:52:19 +0100 Original-Received: from localhost ([127.0.0.1]:37702 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1grhI2-0003yF-K9 for ged-emacs-devel@m.gmane.org; Thu, 07 Feb 2019 05:52:18 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:43229) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1grhHt-0003yA-2Y for emacs-devel@gnu.org; Thu, 07 Feb 2019 05:52:09 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1grhHr-0007B4-PM for emacs-devel@gnu.org; Thu, 07 Feb 2019 05:52:08 -0500 Original-Received: from [195.159.176.226] (port=35616 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1grhHp-00078T-VI for emacs-devel@gnu.org; Thu, 07 Feb 2019 05:52:06 -0500 Original-Received: from list by blaine.gmane.org with local (Exim 4.89) (envelope-from ) id 1grhHl-000ZN0-Pk for emacs-devel@gnu.org; Thu, 07 Feb 2019 11:52:01 +0100 X-Injected-Via-Gmane: http://gmane.org/ Cancel-Lock: sha1:fejApwY+KfbthPVtkKLz3y1nzOQ= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 195.159.176.226 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.devel:233077 Archived-At: ===== Commit message: ===== * sokoban.el: Switch to lexical-binding Switch to lexical-binding Unrelated additional changes: - Do not make variables buffer-local for easier debugging ===== Patch: ===== diff --git a/sokoban.el b/sokoban.el index 4698450..f4a3369 100644 --- a/sokoban.el +++ b/sokoban.el @@ -1,10 +1,10 @@ -;;; sokoban.el --- Implementation of Sokoban for Emacs. +;;; sokoban.el --- Implementation of Sokoban for Emacs. -*- lexical-binding: t -*- -;; Copyright (C) 1998, 2013, 2017 Free Software Foundation, Inc. +;; Copyright (C) 1998, 2013, 2017, 2019 Free Software Foundation, Inc. ;; Author: Glynn Clements ;; Maintainer: Dieter Deyke -;; Version: 1.4.6 +;; Version: 1.4.7 ;; Package-Requires: ((emacs "23.1")) ;; Created: 1997-09-11 ;; Keywords: games @@ -82,18 +82,7 @@ (and (file-exists-p file) file)) (expand-file-name "sokoban.levels" data-directory)))) -(defvar sokoban-width) -(defvar sokoban-height) - -(defvar sokoban-buffer-width) -(defvar sokoban-buffer-height) - -(defvar sokoban-score-x) -(defvar sokoban-score-y) - -(defvar sokoban-level-data nil) - -(defconst sokoban-state-filename (locate-user-emacs-file "sokoban-state")) +(defvar sokoban-state-filename (locate-user-emacs-file "sokoban-state")) ;; ;;;;;;;;;;;;; constants ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -477,28 +466,24 @@ static char * player_on_target_xpm[] = { ;; ;;;;;;;;;;;;; variables ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defvar sokoban-width) +(defvar sokoban-height) +(defvar sokoban-buffer-width) +(defvar sokoban-buffer-height) +(defvar sokoban-score-x) +(defvar sokoban-score-y) +(defvar sokoban-level-data nil) (defvar sokoban-level 0) -(make-variable-buffer-local 'sokoban-level) (defvar sokoban-level-map nil) -(make-variable-buffer-local 'sokoban-level-map) (defvar sokoban-targets 0) -(make-variable-buffer-local 'sokoban-targets) (defvar sokoban-x 0) -(make-variable-buffer-local 'sokoban-x) (defvar sokoban-y 0) -(make-variable-buffer-local 'sokoban-y) (defvar sokoban-moves 0) -(make-variable-buffer-local 'sokoban-moves) (defvar sokoban-pushes 0) -(make-variable-buffer-local 'sokoban-pushes) (defvar sokoban-done 0) -(make-variable-buffer-local 'sokoban-done) (defvar sokoban-mouse-x 0) -(make-variable-buffer-local 'sokoban-mouse-x) (defvar sokoban-mouse-y 0) -(make-variable-buffer-local 'sokoban-mouse-y) (defvar sokoban-undo-list nil) -(make-variable-buffer-local 'sokoban-undo-list) ;; ;;;;;;;;;;;;; keymaps ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -650,7 +635,7 @@ static char * player_on_target_xpm[] = { (let ((y sokoban-score-y)) (dolist (string (list (format "Moves: %05d" sokoban-moves) (format "Pushes: %05d" sokoban-pushes) - (format "Done: %d/%d" + (format "Done: %d/%d " sokoban-done sokoban-targets))) (let* ((len (length string))) @@ -762,9 +747,8 @@ static char * player_on_target_xpm[] = { (incf sokoban-done)) (sokoban-add-push dx dy) (cond ((= sokoban-done sokoban-targets) - (let ((level sokoban-level)) - (with-temp-file sokoban-state-filename - (print level (current-buffer)))) + (with-temp-file sokoban-state-filename + (print sokoban-level (current-buffer))) (sit-for 3) (sokoban-next-level)))))))))) -- Dieter Deyke mailto:dieter.deyke@gmail.com Get my Gnupg key: gpg --keyserver keys.gnupg.net --recv-keys B116EA20