(add-to-list 'load-path "/usr/share/emacs/site-lisp/nethack") (setq nethack-program "/usr/games/nethack-lisp") (require 'nethack) (defadvice nethack (before keymap) "Switch to QWERTY for Nethack." (shell-command "setxkbmap us")) (defadvice nethack-command-quit (after keymap) (shell-command "setxkbmap dvorak")) (defadvice nethack-command-save (after keymap) "Switch back to Dvorak." (shell-command "setxkbmap dvorak")) (define-key nh-map-mode-map '[left] 'nethack-command-west) (define-key nh-map-mode-map '[right] 'nethack-command-east) (define-key nh-map-mode-map '[up] 'nethack-command-north) (define-key nh-map-mode-map '[down] 'nethack-command-south) (define-key nh-map-mode-map '[home] 'nethack-command-northwest) (define-key nh-map-mode-map '[prior] 'nethack-command-northeast) (define-key nh-map-mode-map '[end] 'nethack-command-southwest) (define-key nh-map-mode-map '[next] 'nethack-command-southeast) (defvar nethack-screenshot-file "~/.nethack-notes" "Filename to store Nethack data in.") (defun sacha/nethack-take-screenshot (caption &optional prefix) (interactive (list (read-string "Caption: ") current-prefix-arg)) (save-window-excursion (save-excursion (find-file nethack-screenshot-file) (when current-prefix-arg (erase-buffer)) (goto-char (point-min)) (insert ".#1 " caption "\n\n" (with-current-buffer (get-buffer "*nethack map*") (buffer-substring-no-properties (point-min) (point-max))) "\n\n" (with-current-buffer (get-buffer "*nethack status*") (buffer-substring-no-properties (point-min) (point-max))) "\n\n") (save-buffer))))