aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1994-07-03 18:47:37 +0000
committerRichard M. Stallman1994-07-03 18:47:37 +0000
commitde0724367ce37e0fd26c033dd30316567a14266f (patch)
tree4e0469789ccc0f6c6bf0e4c81d54b9d2707c767f
parentc2ff34f7a3850ee53198bb636e58dc237f3ae81a (diff)
downloademacs-de0724367ce37e0fd26c033dd30316567a14266f.tar.gz
emacs-de0724367ce37e0fd26c033dd30316567a14266f.zip
Use add-hook, (provide 'meese).
(protect-innocence-hook): compare expanded file names for the sake of non-unix file systems. Use expand-file-name instead of concat to create "celibacy.1" file name. Check that the "sex.6" exists.
-rw-r--r--lisp/play/meese.el25
1 files changed, 13 insertions, 12 deletions
diff --git a/lisp/play/meese.el b/lisp/play/meese.el
index 9deb1b69b9c..8a3ad922b8a 100644
--- a/lisp/play/meese.el
+++ b/lisp/play/meese.el
@@ -9,18 +9,19 @@
9;;; Code: 9;;; Code:
10 10
11(defun protect-innocence-hook () 11(defun protect-innocence-hook ()
12 (if (and (equal (file-name-nondirectory buffer-file-name) "sex.6") 12 (let ((dir (file-name-directory buffer-file-name)))
13 (not (y-or-n-p "Are you over 18? "))) 13 (if (and (equal buffer-file-name (expand-file-name "sex.6" dir))
14 (progn 14 (file-exists-p buffer-file-name)
15 (clear-visited-file-modtime) 15 (not (y-or-n-p "Are you over 18? ")))
16 (setq buffer-file-name (concat (file-name-directory buffer-file-name) 16 (progn
17 "celibacy.1")) 17 (clear-visited-file-modtime)
18 (let (buffer-read-only) ; otherwise (erase-buffer) may bomb. 18 (setq buffer-file-name (expand-file-name "celibacy.1" dir))
19 (erase-buffer) 19 (let ((inhibit-read-only t)) ; otherwise (erase-buffer) may bomb.
20 (insert-file-contents buffer-file-name t)) 20 (erase-buffer)
21 (rename-buffer (file-name-nondirectory buffer-file-name))))) 21 (insert-file-contents buffer-file-name t))
22 (rename-buffer (file-name-nondirectory buffer-file-name))))))
22 23
23(or (memq 'protect-innocence-hook find-file-hooks) 24(add-hook 'find-file-hooks 'protect-innocence-hook)
24 (setq find-file-hooks (cons 'protect-innocence-hook find-file-hooks))) 25(provide 'meese)
25 26
26;;; meese.el ends here 27;;; meese.el ends here