Mercurial > emacs
comparison lisp/play/mpuz.el @ 63238:5592f504d53f
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-398
Remove "-face" suffix from mpuz faces
2005-06-10 Miles Bader <miles@gnu.org>
* lisp/play/mpuz.el (mpuz-unsolved, mpuz-solved, mpuz-trivial)
(mpuz-text): Remove "-face" suffix from face names.
(mpuz-unsolved-face, mpuz-solved-face, mpuz-trivial-face)
(mpuz-text-face): New backward-compatibility aliases for renamed faces.
(mpuz-create-buffer, mpuz-paint-digit): Use renamed mpuz faces.
author | Miles Bader <miles@gnu.org> |
---|---|
date | Fri, 10 Jun 2005 11:38:27 +0000 |
parents | 93e71f3dcd14 |
children | 18a818a2ee7c a1b34dec1104 |
comparison
equal
deleted
inserted
replaced
63237:55de715c80dc | 63238:5592f504d53f |
---|---|
55 (defcustom mpuz-allow-double-multiplicator nil | 55 (defcustom mpuz-allow-double-multiplicator nil |
56 "*Allow 2nd factors like 33 or 77." | 56 "*Allow 2nd factors like 33 or 77." |
57 :type 'boolean | 57 :type 'boolean |
58 :group 'mpuz) | 58 :group 'mpuz) |
59 | 59 |
60 (defface mpuz-unsolved-face | 60 (defface mpuz-unsolved |
61 '((((class color)) (:foreground "red1" :bold t)) | 61 '((((class color)) (:foreground "red1" :bold t)) |
62 (t (:bold t))) | 62 (t (:bold t))) |
63 "*Face to use for letters to be solved." | 63 "*Face to use for letters to be solved." |
64 :group 'mpuz) | 64 :group 'mpuz) |
65 | 65 ;; backward-compatibility alias |
66 (defface mpuz-solved-face | 66 (put 'mpuz-unsolved-face 'face-alias 'mpuz-unsolved) |
67 | |
68 (defface mpuz-solved | |
67 '((((class color)) (:foreground "green1" :bold t)) | 69 '((((class color)) (:foreground "green1" :bold t)) |
68 (t (:bold t))) | 70 (t (:bold t))) |
69 "*Face to use for solved digits." | 71 "*Face to use for solved digits." |
70 :group 'mpuz) | 72 :group 'mpuz) |
71 | 73 ;; backward-compatibility alias |
72 (defface mpuz-trivial-face | 74 (put 'mpuz-solved-face 'face-alias 'mpuz-solved) |
75 | |
76 (defface mpuz-trivial | |
73 '((((class color)) (:foreground "blue" :bold t)) | 77 '((((class color)) (:foreground "blue" :bold t)) |
74 (t (:bold t))) | 78 (t (:bold t))) |
75 "*Face to use for trivial digits solved for you." | 79 "*Face to use for trivial digits solved for you." |
76 :group 'mpuz) | 80 :group 'mpuz) |
77 | 81 ;; backward-compatibility alias |
78 (defface mpuz-text-face | 82 (put 'mpuz-trivial-face 'face-alias 'mpuz-trivial) |
83 | |
84 (defface mpuz-text | |
79 '((t (:inherit variable-pitch))) | 85 '((t (:inherit variable-pitch))) |
80 "*Face to use for text on right." | 86 "*Face to use for text on right." |
81 :group 'mpuz) | 87 :group 'mpuz) |
88 ;; backward-compatibility alias | |
89 (put 'mpuz-text-face 'face-alias 'mpuz-text) | |
82 | 90 |
83 | 91 |
84 ;; Mpuz mode and keymaps | 92 ;; Mpuz mode and keymaps |
85 ;;---------------------- | 93 ;;---------------------- |
86 (defcustom mpuz-mode-hook nil | 94 (defcustom mpuz-mode-hook nil |
294 "The general picture of the puzzle screen, as a string.") | 302 "The general picture of the puzzle screen, as a string.") |
295 | 303 |
296 (defun mpuz-create-buffer () | 304 (defun mpuz-create-buffer () |
297 "Create (or recreate) the puzzle buffer. Return it." | 305 "Create (or recreate) the puzzle buffer. Return it." |
298 (let ((buf (get-buffer-create "*Mult Puzzle*")) | 306 (let ((buf (get-buffer-create "*Mult Puzzle*")) |
299 (face '(face mpuz-text-face)) | 307 (face '(face mpuz-text)) |
300 buffer-read-only) | 308 buffer-read-only) |
301 (save-excursion | 309 (save-excursion |
302 (set-buffer buf) | 310 (set-buffer buf) |
303 (erase-buffer) | 311 (erase-buffer) |
304 (insert mpuz-framework) | 312 (insert mpuz-framework) |
345 "Paint all occurrences of DIGIT on the puzzle board." | 353 "Paint all occurrences of DIGIT on the puzzle board." |
346 (let ((char (if (mpuz-digit-solved-p digit) | 354 (let ((char (if (mpuz-digit-solved-p digit) |
347 (+ digit ?0) | 355 (+ digit ?0) |
348 (+ (mpuz-to-letter digit) ?A))) | 356 (+ (mpuz-to-letter digit) ?A))) |
349 (face `(face | 357 (face `(face |
350 ,(cond ((aref mpuz-trivial-digits digit) 'mpuz-trivial-face) | 358 ,(cond ((aref mpuz-trivial-digits digit) 'mpuz-trivial) |
351 ((aref mpuz-found-digits digit) 'mpuz-solved-face) | 359 ((aref mpuz-found-digits digit) 'mpuz-solved) |
352 ('mpuz-unsolved-face)))) | 360 ('mpuz-unsolved)))) |
353 buffer-read-only) | 361 buffer-read-only) |
354 (mapc (lambda (square) | 362 (mapc (lambda (square) |
355 (goto-line (car square)) ; line before column! | 363 (goto-line (car square)) ; line before column! |
356 (move-to-column (cdr square)) | 364 (move-to-column (cdr square)) |
357 (insert char) | 365 (insert char) |