summaryrefslogtreecommitdiff
path: root/lisp/play
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1996-08-17 03:12:18 +0000
committerRichard M. Stallman <rms@gnu.org>1996-08-17 03:12:18 +0000
commit374d4688557a793a77d7b02441283a02b4452c03 (patch)
tree3dceee39c8d2ef33419fb29a113691b1ffd42aff /lisp/play
parentd99b0afcc9f653f6c975b00fd21be2c226e1957c (diff)
downloademacs-374d4688557a793a77d7b02441283a02b4452c03.tar.gz
(decipher-get-undo-copy): New function.
(decipher-get-undo): Use it.
Diffstat (limited to 'lisp/play')
-rw-r--r--lisp/play/decipher.el12
1 files changed, 9 insertions, 3 deletions
diff --git a/lisp/play/decipher.el b/lisp/play/decipher.el
index 9a1dfae2adc..3e487ff3232 100644
--- a/lisp/play/decipher.el
+++ b/lisp/play/decipher.el
@@ -125,11 +125,13 @@ the tail of the list.")
(1 font-lock-keyword-face)
(2 font-lock-string-face)))
"Expressions to fontify in Decipher mode.
+
Ciphertext uses `font-lock-keyword-face', plaintext uses
`font-lock-string-face', comments use `font-lock-comment-face', and
checkpoints use `font-lock-reference-face'. You can customize the
display by changing these variables. For best results, I recommend
that all faces use the same background color.
+
For example, to display ciphertext in the `bold' face, use
(add-hook 'decipher-mode-hook
(lambda () (set (make-local-variable 'font-lock-keyword-face)
@@ -406,13 +408,17 @@ The most useful commands are:
(setcdr (nthcdr (1- new-size) decipher-undo-list) nil)
(setq decipher-undo-list-size new-size))))))
+(defun decipher-get-undo-copy (cons)
+ (if cons
+ (cons (car cons) (cdr cons))))
+
(defun decipher-get-undo (cipher-char plain-char)
;; Return an undo record that will undo the result of
;; (decipher-set-map CIPHER-CHAR PLAIN-CHAR)
- ;; We must use copy-list because the original cons cells will be
+ ;; We must copy the cons cell because the original cons cells will be
;; modified using setcdr.
- (let ((cipher-map (copy-list (rassoc cipher-char decipher-alphabet)))
- (plain-map (copy-list (assoc plain-char decipher-alphabet))))
+ (let ((cipher-map (decipher-get-undo-copy (rassoc cipher-char decipher-alphabet)))
+ (plain-map (decipher-get-undo-copy (assoc plain-char decipher-alphabet))))
(cond ((equal ?\ plain-char)
cipher-map)
((equal cipher-char (cdr plain-map))