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 \.
(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))
(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)
(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)))
;;;;
(defun dun-unix-parse (_args)
- (interactive "*p")
+ (interactive "*p" dun-mode)
(beginning-of-line)
(let (beg esign)
(setq beg (+ (point) 2))
;;;;
(defun dun-dos-parse (_args)
- (interactive "*p")
+ (interactive "*p" dun-mode)
(beginning-of-line)
(let (beg)
(setq beg (+ (point) 3))
(defun dungeon-nil (_arg)
"noop"
- (interactive "*p")
+ (interactive "*p" dun-mode)
nil)
(defun dun-batch-dungeon ()
(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
(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.")
(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)
(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)
(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)
"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))
(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))
(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))
(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))
(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
(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))
(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.
\\<solitaire-mode-map>
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))
(setq solitaire-end-y (solitaire-current-line))))
(defun solitaire-right ()
- (interactive)
+ (interactive nil solitaire-mode)
(let ((start (point)))
(forward-char)
(while (= ?\s (following-char))
(goto-char start))))
(defun solitaire-left ()
- (interactive)
+ (interactive nil solitaire-mode)
(let ((start (point)))
(backward-char)
(while (= ?\s (following-char))
(goto-char start))))
(defun solitaire-up ()
- (interactive)
+ (interactive nil solitaire-mode)
(let ((start (point))
(c (current-column)))
(forward-line -1)
(goto-char start))))
(defun solitaire-down ()
- (interactive)
+ (interactive nil solitaire-mode)
(let ((start (point))
(c (current-column)))
(forward-line 1)
(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.
(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)
(defun solitaire-undo (arg)
"Undo a move in Solitaire."
- (interactive "P")
+ (interactive "P" solitaire-mode)
(let ((buffer-read-only nil))
(undo arg))
(save-excursion
(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!"))
(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