]> code.delx.au - gnu-emacs/blobdiff - lisp/play/decipher.el
*** empty log message ***
[gnu-emacs] / lisp / play / decipher.el
index 18b0199babd742a64ae436661703d4756a03568b..f314a10a9e2be31ada0285ecbfee202d4d9c0f53 100644 (file)
@@ -1,6 +1,6 @@
-;;; decipher.el --- Cryptanalyze monoalphabetic substitution ciphers
+;;; decipher.el --- cryptanalyze monoalphabetic substitution ciphers
 ;;
-;; Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 1996, 2003, 2005 Free Software Foundation, Inc.
 ;;
 ;; Author: Christopher J. Madsen <chris_madsen@geocities.com>
 ;; Keywords: games
@@ -22,6 +22,8 @@
 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 ;; Boston, MA 02111-1307, USA.
 
+;;; Commentary:
+;;
 ;;; Quick Start:
 ;;
 ;; To decipher a message, type or load it into a buffer and type
@@ -37,8 +39,6 @@
 ;;   Helen Fouche Gaines
 ;;   ISBN 0-486-20097-3
 
-;;; Commentary:
-;;
 ;; This package is designed to help you crack simple substitution
 ;; ciphers where one letter stands for another.  It works for ciphers
 ;; with or without word divisions.  (You must set the variable
 
 (defcustom decipher-force-uppercase t
   "*Non-nil means to convert ciphertext to uppercase.
-Nil means the case of the ciphertext is preserved.
+nil means the case of the ciphertext is preserved.
 This variable must be set before typing `\\[decipher]'."
   :type 'boolean
   :group 'decipher)
@@ -108,8 +108,8 @@ This variable must be set before typing `\\[decipher]'."
 
 (defcustom decipher-ignore-spaces nil
   "*Non-nil means to ignore spaces and punctuation when counting digrams.
-You should set this to `nil' if the cipher message is divided into words,
-or `t' if it is not.
+You should set this to nil if the cipher message is divided into words,
+or t if it is not.
 This variable is buffer-local."
   :type 'boolean
   :group 'decipher)
@@ -170,10 +170,8 @@ in your `.emacs' file.")
       (define-key decipher-mode-map "R" 'decipher-restore-checkpoint)
       (define-key decipher-mode-map "U" 'decipher-undo)
       (define-key decipher-mode-map " " 'decipher-keypress)
-      (substitute-key-definition 'undo  'decipher-undo
-                                 decipher-mode-map global-map)
-      (substitute-key-definition 'advertised-undo  'decipher-undo
-                                 decipher-mode-map global-map)
+      (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)
@@ -307,11 +305,11 @@ The most useful commands are:
       (setq case-fold-search nil))      ;Case is significant when searching
   (use-local-map decipher-mode-map)
   (set-syntax-table decipher-mode-syntax-table)
-  (decipher-read-alphabet)
+  (unless (= (point-min) (point-max))
+    (decipher-read-alphabet))
   (set (make-local-variable 'font-lock-defaults)
        '(decipher-font-lock-keywords t))
   ;; Make the buffer writable when we exit Decipher mode:
-  (make-local-hook 'change-major-mode-hook)
   (add-hook 'change-major-mode-hook
             (lambda () (setq buffer-read-only nil
                              buffer-undo-list nil))
@@ -687,7 +685,7 @@ ciphertext."
       (set-buffer (decipher-stats-buffer))
       (goto-char (point-min))
       (or (re-search-forward (format "^%c: " cipher-char) nil t)
-          (error "Character `%c' is not used in ciphertext." cipher-char))
+          (error "Character `%c' is not used in ciphertext" cipher-char))
       (forward-line -1)
       (setq start (point))
       (forward-line 3)
@@ -1071,4 +1069,5 @@ if it can't, it signals an error."
 ;;;          (delete-backward-char 1)
 ;;;          (insert ")\n"))))))
 
+;;; arch-tag: 8f094d88-ffe1-4f99-afe3-a5e81dd939d9
 ;;; decipher.el ends here