X-Git-Url: https://git.hcoop.net/bpt/emacs.git/blobdiff_plain/639b2760f19231881f753c8f1f7822eab457c751..0d6459dfb52188481bfd6bb53f1b2f653ecd6a5d:/lisp/play/decipher.el diff --git a/lisp/play/decipher.el b/lisp/play/decipher.el index 83186c4244..3de8ca3d4f 100644 --- a/lisp/play/decipher.el +++ b/lisp/play/decipher.el @@ -1,7 +1,6 @@ ;;; decipher.el --- cryptanalyze monoalphabetic substitution ciphers ;; -;; Copyright (C) 1995, 1996, 2001, 2002, 2003, 2004, 2005, 2006, 2007, -;; 2008, 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 1995-1996, 2001-2011 Free Software Foundation, Inc. ;; ;; Author: Christopher J. Madsen ;; Keywords: games @@ -154,38 +153,37 @@ For example, to display ciphertext in the `bold' face, use 'bold))) in your `.emacs' file.") -(defvar decipher-mode-map nil +(defvar decipher-mode-map + (let ((map (make-keymap))) + (suppress-keymap map) + (define-key map "A" 'decipher-show-alphabet) + (define-key map "C" 'decipher-complete-alphabet) + (define-key map "D" 'decipher-digram-list) + (define-key map "F" 'decipher-frequency-count) + (define-key map "M" 'decipher-make-checkpoint) + (define-key map "N" 'decipher-adjacency-list) + (define-key map "R" 'decipher-restore-checkpoint) + (define-key map "U" 'decipher-undo) + (define-key map " " 'decipher-keypress) + (define-key map [remap undo] 'decipher-undo) + (define-key map [remap advertised-undo] 'decipher-undo) + (let ((key ?a)) + (while (<= key ?z) + (define-key map (vector key) 'decipher-keypress) + (incf key))) + map) "Keymap for Decipher mode.") -(if (not decipher-mode-map) - (progn - (setq decipher-mode-map (make-keymap)) - (suppress-keymap decipher-mode-map) - (define-key decipher-mode-map "A" 'decipher-show-alphabet) - (define-key decipher-mode-map "C" 'decipher-complete-alphabet) - (define-key decipher-mode-map "D" 'decipher-digram-list) - (define-key decipher-mode-map "F" 'decipher-frequency-count) - (define-key decipher-mode-map "M" 'decipher-make-checkpoint) - (define-key decipher-mode-map "N" 'decipher-adjacency-list) - (define-key decipher-mode-map "R" 'decipher-restore-checkpoint) - (define-key decipher-mode-map "U" 'decipher-undo) - (define-key decipher-mode-map " " 'decipher-keypress) - (define-key decipher-mode-map [remap undo] 'decipher-undo) - (define-key decipher-mode-map [remap advertised-undo] 'decipher-undo) - (let ((key ?a)) - (while (<= key ?z) - (define-key decipher-mode-map (vector key) 'decipher-keypress) - (incf key))))) - -(defvar decipher-stats-mode-map nil - "Keymap for Decipher-Stats mode.") -(if (not decipher-stats-mode-map) - (progn - (setq decipher-stats-mode-map (make-keymap)) - (suppress-keymap decipher-stats-mode-map) - (define-key decipher-stats-mode-map "D" 'decipher-digram-list) - (define-key decipher-stats-mode-map "F" 'decipher-frequency-count) - (define-key decipher-stats-mode-map "N" 'decipher-adjacency-list) - )) + + +(defvar decipher-stats-mode-map + (let ((map (make-keymap))) + (suppress-keymap map) + (define-key map "D" 'decipher-digram-list) + (define-key map "F" 'decipher-frequency-count) + (define-key map "N" 'decipher-adjacency-list) + map) +"Keymap for Decipher-Stats mode.") + (defvar decipher-mode-syntax-table nil "Decipher mode syntax table") @@ -488,7 +486,7 @@ The most useful commands are: (let ((font-lock-fontify-region-function 'ignore)) ;; insert-and-inherit will pick the right face automatically (while (search-forward-regexp "^:" nil t) - (setq bound (save-excursion (end-of-line) (point))) + (setq bound (point-at-eol)) (while (search-forward cipher-string bound 'end) (decipher-insert plain-char))))))) @@ -1063,5 +1061,4 @@ if it can't, it signals an error." ;; (delete-char -1) ;; (insert ")\n")))))) -;; arch-tag: 8f094d88-ffe1-4f99-afe3-a5e81dd939d9 ;;; decipher.el ends here