PageRenderTime 52ms CodeModel.GetById 28ms RepoModel.GetById 0ms app.codeStats 0ms

/emacspeak-29.0/lisp/emacspeak-jawbreaker.el

#
Emacs Lisp | 117 lines | 34 code | 18 blank | 65 comment | 2 complexity | 43abb393a38a8488f1c642b2e342d136 MD5 | raw file
Possible License(s): MIT
  1. ;;; emacspeak-jawbreaker.el --- Talk to Firefox/JawBreaker via MozRepl
  2. ;;; $Id: emacspeak-jawbreaker.el 5798 2008-08-22 17:35:01Z tv.raman.tv $
  3. ;;; $Author: tv.raman.tv $
  4. ;;; Description: Play JawBreaker game from Emacs in Firefox
  5. ;;; Keywords: Emacspeak, Audio Desktop Firefox, Piglets
  6. ;;{{{ LCD Archive entry:
  7. ;;; LCD Archive Entry:
  8. ;;; emacspeak| T. V. Raman |raman@cs.cornell.edu
  9. ;;; A speech interface to Emacs |
  10. ;;; $Date: 2008-03-19 07:02:19 -0700 (Wed, 19 Mar 2008) $ |
  11. ;;; $Revision: 4532 $ |
  12. ;;; Location undetermined
  13. ;;;
  14. ;;}}}
  15. ;;{{{ Copyright:
  16. ;;;Copyright (C) 1995 -- 2007, T. V. Raman
  17. ;;; Copyright (c) 1994, 1995 by Digital Equipment Corporation.
  18. ;;; All Rights Reserved.
  19. ;;;
  20. ;;; This file is not part of GNU Emacs, but the same permissions apply.
  21. ;;;
  22. ;;; GNU Emacs is free software; you can redistribute it and/or modify
  23. ;;; it under the terms of the GNU General Public License as published by
  24. ;;; the Free Software Foundation; either version 2, or (at your option)
  25. ;;; any later version.
  26. ;;;
  27. ;;; GNU Emacs is distributed in the hope that it will be useful,
  28. ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  29. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  30. ;;; GNU General Public License for more details.
  31. ;;;
  32. ;;; You should have received a copy of the GNU General Public License
  33. ;;; along with GNU Emacs; see the file COPYING. If not, write to
  34. ;;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  35. ;;}}}
  36. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  37. ;;{{{ introduction
  38. ;;; Commentary:
  39. ;;; MozRepl provides a read-eval-print loop into Firefox
  40. ;;; Module emacspeak-moz provides convenient functions for driving MozRepl
  41. ;;; See http://repo.hyperstruct.net/mozlab
  42. ;;; Using that module, you can connect two large pigs ---
  43. ;;; Emacs and Firefox via a socket ---
  44. ;;; the result as you can expect is to produce piglets.
  45. ;;; emacspeak-jawbreaker is a piglet that enables one to play
  46. ;;; The JawBreaker game from within Emacspeak.
  47. ;;; I run Firefox headless using the etc/firebox script
  48. ;;; And I have Fire Vox installed to provide the Firefox side of the spoken output.
  49. ;;; Code:
  50. ;;}}}
  51. ;;{{{ Required modules
  52. (require 'cl)
  53. (declaim (optimize (safety 0) (speed 3)))
  54. (require 'emacspeak-preamble)
  55. (require 'derived)
  56. (require 'emacspeak-piglets)
  57. ;;}}}
  58. ;;{{{ Constants
  59. (defvar emacspeak-jawbreaker-url
  60. "http://www.minijuegosgratis.com/juegos/jawbreaker/jawbreaker.htm"
  61. "URL for game page.")
  62. ;;}}}
  63. ;;{{{ Define our mode:
  64. (define-derived-mode emacspeak-jawbreaker-mode emacspeak-piglets-mode
  65. "JawBreaker Interaction"
  66. "Major mode for JawBreaker interaction.
  67. Launches the game, and sends keypresses from the special buffer
  68. to the running game. ")
  69. ;;}}}
  70. ;;{{{ Interactive Commands
  71. (defvar emacspeak-jawbreaker-buffer "*Jaw Breaker Interaction*"
  72. "Buffer where we play JawBreaker.")
  73. ;;;###autoload
  74. (defun emacspeak-jawbreaker ()
  75. "Opens JawBreaker game in Firefox."
  76. (interactive)
  77. (declare (special emacspeak-jawbreaker-url
  78. emacspeak-jawbreaker-buffer))
  79. (comint-send-string
  80. (inferior-moz-process)
  81. (format "content.location.href='%s'\n"
  82. emacspeak-jawbreaker-url))
  83. (save-excursion
  84. (set-buffer (get-buffer-create emacspeak-jawbreaker-buffer))
  85. (erase-buffer)
  86. (setq buffer-undo-list t)
  87. (emacspeak-jawbreaker-mode)
  88. (switch-to-buffer emacspeak-jawbreaker-buffer)
  89. (emacspeak-speak-mode-line)
  90. (emacspeak-auditory-icon 'open-object)))
  91. ;;}}}
  92. (provide 'emacspeak-jawbreaker)
  93. ;;{{{ end of file
  94. ;;; local variables:
  95. ;;; folded-file: t
  96. ;;; byte-compile-dynamic: t
  97. ;;; end:
  98. ;;}}}