PageRenderTime 45ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 1ms

/emacspeak-29.0/lisp/emacspeak-firevox.el

#
Emacs Lisp | 166 lines | 66 code | 32 blank | 68 comment | 2 complexity | 747e761bd026e988802fa03430f5132a MD5 | raw file
Possible License(s): MIT
  1. ;;; emacspeak-firevox.el.el --- FireVox Piglet
  2. ;;; $Id: emacspeak-firevox.el 5798 2008-08-22 17:35:01Z tv.raman.tv $
  3. ;;; $Author: tv.raman.tv $
  4. ;;; Description: Play Firevox 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-05-30 21:37:49 -0700 (Fri, 30 May 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-firevox is a piglet that enables one to play
  46. ;;; The Firevox 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 'emacspeak-piglets)
  56. ;;}}}
  57. ;;{{{ Constants
  58. (defvar emacspeak-firevox-url
  59. "http://www.minijuegosgratis.com/juegos/firevox/firevox.htm"
  60. "URL for game page.")
  61. ;;}}}
  62. ;;{{{ Interactive Commands And Keybindings:
  63. (defvar emacspeak-firevox-buffer "*Fire Vox Interaction*"
  64. "Buffer where we talk to Firevox.")
  65. ;;; Interactive commands:
  66. ;;;###autoload
  67. (defun emacspeak-firevox-read-next ()
  68. "Read next item on page."
  69. (interactive)
  70. (emacspeak-moz-eval-expression
  71. "CLC_SR_StopSpeaking();CLC_SR_ReadContent(1)\n"))
  72. ;;;###autoload
  73. (defun emacspeak-firevox-read-previous ()
  74. "Read next item on page."
  75. (interactive)
  76. (emacspeak-moz-eval-expression
  77. "CLC_SR_StopSpeaking();CLC_SR_ReadContent(-1)\n"))
  78. (defun emacspeak-firevox-read-current ()
  79. "Read current node."
  80. (emacspeak-moz-eval-expression
  81. "CLC_SR_StopSpeaking();CLC_SR_ReadCurrentAtomicObject()\n"))
  82. ;;;###autoload
  83. (defun emacspeak-firevox-read-parent ()
  84. "Read parent node."
  85. (interactive)
  86. (emacspeak-moz-eval-expression
  87. "CLC_SR_StopSpeaking();CLC_SR_SayParentTextContent()\n"))
  88. ;;;###autoload
  89. (defun emacspeak-firevox-websearch (query)
  90. "Perform Websearch via the Firefox URL bar."
  91. (interactive "sWebSearch:")
  92. (emacspeak-moz-eval-expression
  93. (format "repl.adom.webSearch('%s')\n" query)))
  94. (defun emacspeak-firevox-setup-keys ()
  95. "Set up FireVox keybindings."
  96. (declare (special emacspeak-piglets))
  97. (loop for k in
  98. '(
  99. ("\C-n" emacspeak-firevox-read-next)
  100. ("\C-p" emacspeak-firevox-read-previous)
  101. ("\C-m" emacspeak-piglets-enter)
  102. ("\C-i" emacspeak-piglets-tab)
  103. ("\M-m" emacspeak-piglets-silence) ;;; think mute
  104. ("\C-@" emacspeak-firevox-read-current)
  105. ("\C-^" emacspeak-firevox-read-parent)
  106. ("\C-o" emacspeak-moz-goto-url)
  107. ("\C-r" emacspeak-moz-refresh)
  108. ("\C-w" emacspeak-firevox-websearch)
  109. )
  110. do
  111. (emacspeak-keymap-update emacspeak-piglets-mode-map k)))
  112. ;;;###autoload
  113. (defun emacspeak-firevox ()
  114. "Creates FireVox interaction."
  115. (interactive)
  116. (declare (special emacspeak-firevox-buffer))
  117. (save-excursion
  118. (set-buffer (get-buffer-create emacspeak-firevox-buffer))
  119. (erase-buffer)
  120. (setq buffer-undo-list t)
  121. (emacspeak-piglets-mode)
  122. (emacspeak-firevox-setup-keys))
  123. (switch-to-buffer emacspeak-firevox-buffer)
  124. (emacspeak-speak-mode-line)
  125. (emacspeak-auditory-icon 'open-object))
  126. ;;}}}
  127. (provide 'emacspeak-firevox)
  128. ;;{{{ end of file
  129. ;;; local variables:
  130. ;;; folded-file: t
  131. ;;; byte-compile-dynamic: t
  132. ;;; end:
  133. ;;}}}