aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Kangas2021-01-30 00:32:20 +0100
committerStefan Kangas2021-01-30 00:33:15 +0100
commitf3f6e84ca6f16c243cd1242ca51c333972a4bb9a (patch)
tree7766864c47447739727284433202523382570886
parent1a4bb1e2f28ec20aff23bab335ba949a0f2b75a1 (diff)
downloademacs-f3f6e84ca6f16c243cd1242ca51c333972a4bb9a.tar.gz
emacs-f3f6e84ca6f16c243cd1242ca51c333972a4bb9a.zip
Use lexical-binding in mpuz.el
* lisp/play/mpuz.el: Use lexical-binding. Remove redundant :group args. (mpuz-switch-to-window): Minor cleanup.
-rw-r--r--lisp/play/mpuz.el30
1 files changed, 11 insertions, 19 deletions
diff --git a/lisp/play/mpuz.el b/lisp/play/mpuz.el
index 7fff604aead..838bddfb665 100644
--- a/lisp/play/mpuz.el
+++ b/lisp/play/mpuz.el
@@ -1,4 +1,4 @@
1;;; mpuz.el --- multiplication puzzle for GNU Emacs 1;;; mpuz.el --- multiplication puzzle for GNU Emacs -*- lexical-binding: t -*-
2 2
3;; Copyright (C) 1990, 2001-2021 Free Software Foundation, Inc. 3;; Copyright (C) 1990, 2001-2021 Free Software Foundation, Inc.
4 4
@@ -40,49 +40,41 @@
40The value t means never ding, and `error' means only ding on wrong input." 40The value t means never ding, and `error' means only ding on wrong input."
41 :type '(choice (const :tag "No" nil) 41 :type '(choice (const :tag "No" nil)
42 (const :tag "Yes" t) 42 (const :tag "Yes" t)
43 (const :tag "If correct" error)) 43 (const :tag "If correct" error)))
44 :group 'mpuz)
45 44
46(defcustom mpuz-solve-when-trivial t 45(defcustom mpuz-solve-when-trivial t
47 "Solve any row that can be trivially calculated from what you've found." 46 "Solve any row that can be trivially calculated from what you've found."
48 :type 'boolean 47 :type 'boolean)
49 :group 'mpuz)
50 48
51(defcustom mpuz-allow-double-multiplicator nil 49(defcustom mpuz-allow-double-multiplicator nil
52 "Allow 2nd factors like 33 or 77." 50 "Allow 2nd factors like 33 or 77."
53 :type 'boolean 51 :type 'boolean)
54 :group 'mpuz)
55 52
56(defface mpuz-unsolved 53(defface mpuz-unsolved
57 '((default :weight bold) 54 '((default :weight bold)
58 (((class color)) :foreground "red1")) 55 (((class color)) :foreground "red1"))
59 "Face for letters to be solved." 56 "Face for letters to be solved.")
60 :group 'mpuz)
61 57
62(defface mpuz-solved 58(defface mpuz-solved
63 '((default :weight bold) 59 '((default :weight bold)
64 (((class color)) :foreground "green1")) 60 (((class color)) :foreground "green1"))
65 "Face for solved digits." 61 "Face for solved digits.")
66 :group 'mpuz)
67 62
68(defface mpuz-trivial 63(defface mpuz-trivial
69 '((default :weight bold) 64 '((default :weight bold)
70 (((class color)) :foreground "blue")) 65 (((class color)) :foreground "blue"))
71 "Face for trivial digits solved for you." 66 "Face for trivial digits solved for you.")
72 :group 'mpuz)
73 67
74(defface mpuz-text 68(defface mpuz-text
75 '((t :inherit variable-pitch)) 69 '((t :inherit variable-pitch))
76 "Face for text on right." 70 "Face for text on right.")
77 :group 'mpuz)
78 71
79 72
80;; Mpuz mode and keymaps 73;; Mpuz mode and keymaps
81;;---------------------- 74;;----------------------
82(defcustom mpuz-mode-hook nil 75(defcustom mpuz-mode-hook nil
83 "Hook to run upon entry to mpuz." 76 "Hook to run upon entry to mpuz."
84 :type 'hook 77 :type 'hook)
85 :group 'mpuz)
86 78
87(defvar mpuz-mode-map 79(defvar mpuz-mode-map
88 (let ((map (make-sparse-keymap))) 80 (let ((map (make-sparse-keymap)))
@@ -341,8 +333,8 @@ You may abort a game by typing \\<mpuz-mode-map>\\[mpuz-offer-abort]."
341 333
342(defun mpuz-switch-to-window () 334(defun mpuz-switch-to-window ()
343 "Find or create the Mult-Puzzle buffer, and display it." 335 "Find or create the Mult-Puzzle buffer, and display it."
344 (let ((buf (mpuz-get-buffer))) 336 (let ((buf (or (mpuz-get-buffer)
345 (or buf (setq buf (mpuz-create-buffer))) 337 (mpuz-create-buffer))))
346 (switch-to-buffer buf) 338 (switch-to-buffer buf)
347 (setq buffer-read-only t) 339 (setq buffer-read-only t)
348 (mpuz-mode))) 340 (mpuz-mode)))