From f3762d59d92c832f8417e8eeadc49c19d1c367bb Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Thu, 16 Sep 2021 14:47:51 +0200 Subject: [PATCH] Do interactive mode tagging for play/*.el --- lisp/play/doctor.el | 5 +++-- lisp/play/dunnet.el | 11 ++++++----- lisp/play/mpuz.el | 7 ++++--- lisp/play/pong.el | 15 +++++++-------- lisp/play/solitaire.el | 27 ++++++++++++++------------- 5 files changed, 34 insertions(+), 31 deletions(-) diff --git a/lisp/play/doctor.el b/lisp/play/doctor.el index bf923f4f2e5..9777fc3ea24 100644 --- a/lisp/play/doctor.el +++ b/lisp/play/doctor.el @@ -137,6 +137,7 @@ Like Text mode with Auto Fill mode except that RET when point is after a newline, or LFD at any time, reads the sentence before point, and prints the Doctor's answer." + :interactive nil (make-doctor-variables) (turn-on-auto-fill) (doctor-type '(i am the psychotherapist \. @@ -827,14 +828,14 @@ reads the sentence before point, and prints the Doctor's answer." (defun doctor-ret-or-read (arg) "Insert a newline if preceding character is not a newline. Otherwise call the Doctor to parse preceding sentence." - (interactive "*p") + (interactive "*p" doctor-mode) (if (= (preceding-char) ?\n) (doctor-read-print) (newline arg))) (defun doctor-read-print () "Top level loop." - (interactive) + (interactive nil doctor-mode) (setq doctor-sent (doctor-readin)) (insert "\n") (setq doctor--lincount (1+ doctor--lincount)) diff --git a/lisp/play/dunnet.el b/lisp/play/dunnet.el index 9d5ee261976..332e743ed8e 100644 --- a/lisp/play/dunnet.el +++ b/lisp/play/dunnet.el @@ -1135,11 +1135,12 @@ treasures for points?" "4" "four") (define-derived-mode dun-mode text-mode "Dungeon" "Major mode for running dunnet." + :interactive nil (setq-local scroll-step 2)) (defun dun-parse (_arg) "Function called when return is pressed in interactive mode to parse line." - (interactive "*p") + (interactive "*p" dun-mode) (beginning-of-line) (let ((beg (1+ (point))) line) @@ -2229,7 +2230,7 @@ Call the proper verb with the rest of the line passed in as a list." (defun dun-fix-screen () "In window mode, keep screen from jumping by keeping last line at the bottom of the screen." - (interactive) + (interactive nil dun-mode) (forward-line (- 0 (- (window-height) 2 ))) (set-window-start (selected-window) (point)) (goto-char (point-max))) @@ -2336,7 +2337,7 @@ Also prints current score to let user know he has scored." ;;;; (defun dun-unix-parse (_args) - (interactive "*p") + (interactive "*p" dun-mode) (beginning-of-line) (let (beg esign) (setq beg (+ (point) 2)) @@ -2825,7 +2826,7 @@ drwxr-xr-x 3 root staff 2048 Jan 1 1970 ..") ;;;; (defun dun-dos-parse (_args) - (interactive "*p") + (interactive "*p" dun-mode) (beginning-of-line) (let (beg) (setq beg (+ (point) 3)) @@ -3119,7 +3120,7 @@ File not found"))) (defun dungeon-nil (_arg) "noop" - (interactive "*p") + (interactive "*p" dun-mode) nil) (defun dun-batch-dungeon () diff --git a/lisp/play/mpuz.el b/lisp/play/mpuz.el index 838bddfb665..123cc3cfacb 100644 --- a/lisp/play/mpuz.el +++ b/lisp/play/mpuz.el @@ -89,6 +89,7 @@ The value t means never ding, and `error' means only ding on wrong input." (define-derived-mode mpuz-mode fundamental-mode "Mult Puzzle" + :interactive nil "Multiplication puzzle mode. You have to guess which letters stand for which digits in the @@ -367,7 +368,7 @@ You may abort a game by typing \\\\[mpuz-offer-abort]." (defun mpuz-offer-abort () "Ask if user wants to abort current puzzle." - (interactive) + (interactive nil mpuz-mode) (if (y-or-n-p "Abort game? ") (let ((buf (mpuz-get-buffer))) (message "Mult Puzzle aborted.") @@ -389,7 +390,7 @@ You may abort a game by typing \\\\[mpuz-offer-abort]." (defun mpuz-try-letter () "Propose a digit for a letter in puzzle." - (interactive) + (interactive nil mpuz-mode) (if mpuz-in-progress (let (letter-char digit digit-char) (setq letter-char (upcase last-command-event) @@ -474,7 +475,7 @@ You may abort a game by typing \\\\[mpuz-offer-abort]." (defun mpuz-show-solution (row) "Display solution for debugging purposes." - (interactive "P") + (interactive "P" mpuz-mode) (mpuz-switch-to-window) (mpuz-solve (if row (* 2 (prefix-numeric-value row)))) (mpuz-paint-board) diff --git a/lisp/play/pong.el b/lisp/play/pong.el index b73dbc1010e..b8545dfa82f 100644 --- a/lisp/play/pong.el +++ b/lisp/play/pong.el @@ -216,7 +216,6 @@ (defun pong-init-buffer () "Initialize pong buffer and draw stuff thanks to gamegrid library." - (interactive) (get-buffer-create pong-buffer-name) (switch-to-buffer pong-buffer-name) (use-local-map pong-mode-map) @@ -249,7 +248,7 @@ "Move bat 1 up. This is called left for historical reasons, since in some pong implementations you move with left/right paddle." - (interactive) + (interactive nil pong-mode) (if (> pong-bat-player1 1) (and (setq pong-bat-player1 (1- pong-bat-player1)) @@ -259,7 +258,7 @@ implementations you move with left/right paddle." (defun pong-move-right () "Move bat 1 down." - (interactive) + (interactive nil pong-mode) (if (< (+ pong-bat-player1 pong-bat-width) (1- pong-height)) (and (setq pong-bat-player1 (1+ pong-bat-player1)) @@ -269,7 +268,7 @@ implementations you move with left/right paddle." (defun pong-move-up () "Move bat 2 up." - (interactive) + (interactive nil pong-mode) (if (> pong-bat-player2 1) (and (setq pong-bat-player2 (1- pong-bat-player2)) @@ -279,7 +278,7 @@ implementations you move with left/right paddle." (defun pong-move-down () "Move bat 2 down." - (interactive) + (interactive nil pong-mode) (if (< (+ pong-bat-player2 pong-bat-width) (1- pong-height)) (and (setq pong-bat-player2 (1+ pong-bat-player2)) @@ -412,7 +411,7 @@ detection and checks if a player scores." (defun pong-pause () "Pause the game." - (interactive) + (interactive nil pong-mode) (gamegrid-kill-timer) ;; Oooohhh ugly. I don't know why, gamegrid-kill-timer don't do the ;; jobs it is made for. So I have to do it "by hand". Anyway, next @@ -424,7 +423,7 @@ detection and checks if a player scores." (defun pong-resume () "Resume a paused game." - (interactive) + (interactive nil pong-mode) (define-key pong-mode-map pong-pause-key 'pong-pause) (gamegrid-start-timer pong-timer-delay 'pong-update-game)) @@ -432,7 +431,7 @@ detection and checks if a player scores." (defun pong-quit () "Quit the game and kill the pong buffer." - (interactive) + (interactive nil pong-mode) (gamegrid-kill-timer) ;; Be sure not to draw things in another buffer and wait for some ;; time. diff --git a/lisp/play/solitaire.el b/lisp/play/solitaire.el index e74ba98ca1b..bc1a0e44cbf 100644 --- a/lisp/play/solitaire.el +++ b/lisp/play/solitaire.el @@ -93,6 +93,7 @@ To learn how to play Solitaire, see the documentation for function \\ The usual mnemonic keys move the cursor around the board; in addition, \\[solitaire-move] is a prefix character for actually moving a stone on the board." + :interactive nil (setq truncate-lines t) (setq show-trailing-whitespace nil)) @@ -248,7 +249,7 @@ Pick your favorite shortcuts: (setq solitaire-end-y (solitaire-current-line)))) (defun solitaire-right () - (interactive) + (interactive nil solitaire-mode) (let ((start (point))) (forward-char) (while (= ?\s (following-char)) @@ -259,7 +260,7 @@ Pick your favorite shortcuts: (goto-char start)))) (defun solitaire-left () - (interactive) + (interactive nil solitaire-mode) (let ((start (point))) (backward-char) (while (= ?\s (following-char)) @@ -270,7 +271,7 @@ Pick your favorite shortcuts: (goto-char start)))) (defun solitaire-up () - (interactive) + (interactive nil solitaire-mode) (let ((start (point)) (c (current-column))) (forward-line -1) @@ -286,7 +287,7 @@ Pick your favorite shortcuts: (goto-char start)))) (defun solitaire-down () - (interactive) + (interactive nil solitaire-mode) (let ((start (point)) (c (current-column))) (forward-line 1) @@ -301,13 +302,13 @@ Pick your favorite shortcuts: (goto-char start)))) (defun solitaire-center-point () - (interactive) + (interactive nil solitaire-mode) (goto-char solitaire-center)) -(defun solitaire-move-right () (interactive) (solitaire-move '[right])) -(defun solitaire-move-left () (interactive) (solitaire-move '[left])) -(defun solitaire-move-up () (interactive) (solitaire-move '[up])) -(defun solitaire-move-down () (interactive) (solitaire-move '[down])) +(defun solitaire-move-right () (interactive nil solitaire-mode) (solitaire-move '[right])) +(defun solitaire-move-left () (interactive nil solitaire-mode) (solitaire-move '[left])) +(defun solitaire-move-up () (interactive nil solitaire-mode) (solitaire-move '[up])) +(defun solitaire-move-down () (interactive nil solitaire-mode) (solitaire-move '[down])) (defun solitaire-possible-move (movesymbol) "Check if a move is possible from current point in the specified direction. @@ -332,7 +333,7 @@ which a stone will be taken away) and target." (defun solitaire-move (dir) "Pseudo-prefix command to move a stone in Solitaire." - (interactive "kMove where? ") + (interactive "kMove where? " solitaire-mode) (let* ((class (solitaire-possible-move (lookup-key solitaire-mode-map dir))) (buffer-read-only nil)) (if (stringp class) @@ -356,7 +357,7 @@ which a stone will be taken away) and target." (defun solitaire-undo (arg) "Undo a move in Solitaire." - (interactive "P") + (interactive "P" solitaire-mode) (let ((buffer-read-only nil)) (undo arg)) (save-excursion @@ -393,7 +394,7 @@ which a stone will be taken away) and target." (defun solitaire-do-check (&optional _arg) "Check for any possible moves in Solitaire." - (interactive "P") + (interactive "P" solitaire-mode) (let ((moves (solitaire-check))) (cond ((= 1 solitaire-stones) (message "Yeah! You made it! Only the King is left!")) @@ -414,7 +415,7 @@ Seen in info on text lines." (defun solitaire-solve () "Spoil Solitaire by solving the game for you - nearly ... ... stops with five stones left ;)" - (interactive) + (interactive nil solitaire-mode) (when (< solitaire-stones 32) (error "Cannot solve game in progress")) (let ((allmoves [up up S-down up left left S-right up up left S-down