PageRenderTime 46ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/emacspeak-29.0/lisp/emacspeak-ess.el

#
Emacs Lisp | 159 lines | 79 code | 21 blank | 59 comment | 3 complexity | 0968baae35f8e077ebdaa09c03b1ac75 MD5 | raw file
Possible License(s): MIT
  1. ;;; emacspeak-ess.el --- Speech-enable ESS: Emacs Speaks Statistics
  2. ;;; $Id: emacspeak-ess.el 5798 2008-08-22 17:35:01Z tv.raman.tv $
  3. ;;; $Author: tv.raman.tv $
  4. ;;; Description: Speech-enable ESS An Emacs Interface to R and others
  5. ;;; Keywords: Emacspeak, Audio Desktop Statistics, R
  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: 2007-09-01 15:30:13 -0700 (Sat, 01 Sep 2007) $ |
  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. ;;; ESS == Emacs Speaks Statistics
  40. ;;; This module makes ESS speak.
  41. ;;}}}
  42. ;;{{{ Required modules
  43. (require 'cl)
  44. (declaim (optimize (safety 0) (speed 3)))
  45. (require 'emacspeak-preamble)
  46. ;;}}}
  47. ;;{{{ Advice edeitor to speak
  48. (defadvice ess-indent-command(after emacspeak pre act comp)
  49. "Speak the line."
  50. (when (interactive-p)
  51. (emacspeak-speak-line)))
  52. (defadvice ess-smart-underscore (around emacspeak pre act comp)
  53. "Speak what you inserted."
  54. (cond
  55. ((interactive-p)
  56. (let ((orig (point)))
  57. ad-do-it
  58. (dtk-speak (buffer-substring orig (point)))))
  59. (t ad-do-it))
  60. ad-return-value)
  61. (defadvice ess-electric-brace (after emacspeak pre act comp)
  62. "Speak what you inserted.
  63. Cue electric insertion with a tone."
  64. (when (interactive-p)
  65. (let ((emacspeak-speak-messages nil))
  66. (emacspeak-speak-this-char last-input-char)
  67. (dtk-tone 800 50 t))))
  68. ;;}}}
  69. ;;{{{ Structure commands
  70. (loop for f in
  71. '(ess-beginning-of-function ess-end-of-function)
  72. do
  73. (eval
  74. `(defadvice ,f (after emacspeak pre act comp)
  75. "Produce auditory feedback."
  76. (when (interactive-p)
  77. (emacspeak-auditory-icon 'large-movement)
  78. (emacspeak-speak-line)))))
  79. (defadvice ess-mark-function (after emacspeak pre act comp)
  80. "Provide auditory feedback."
  81. (when (interactive-p)
  82. (emacspeak-auditory-icon 'select-object)
  83. (message "Marked function containing %s lines."
  84. (count-lines (point) (mark)))))
  85. (defadvice ess-indent-exp (after emacspeak pre act)
  86. "Provide auditory feedback."
  87. (when (interactive-p)
  88. (emacspeak-auditory-icon 'fill-object )
  89. (message "Indented current s expression ")))
  90. ;;}}}
  91. ;;{{{ Evaluators
  92. (loop for f in
  93. '(
  94. ess-eval-function ess-eval-buffer
  95. ess-eval-function-and-go ess-eval-buffer-and-go
  96. ess-eval-chunk ess-eval-chunk-and-go
  97. ess-eval-line ess-eval-line-and-go
  98. ess-eval-paragraph ess-eval-paragraph-and-go
  99. ess-eval-paragraph-and-step
  100. ess-eval-region ess-eval-region-and-go
  101. ess-eval-line-and-step ess-eval-function-or-paragraph-and-step)
  102. do
  103. (eval
  104. `
  105. (defadvice ,f (after emacspeak pre act comp)
  106. "Provide auditory feedback."
  107. (when (interactive-p)
  108. (emacspeak-auditory-icon 'select-object)))))
  109. ;;}}}
  110. ;;{{{ Switchers
  111. (defadvice ess-display-help-on-object(after emacspeak pre act
  112. comp)
  113. "Announce help."
  114. (when (interactive-p)
  115. (emacspeak-auditory-icon 'help)
  116. (message "Displayed help in other window.")))
  117. (loop for f in
  118. '(
  119. ess-switch-to-ess ess-switch-to-end-of-ESS)
  120. do
  121. (eval
  122. `(defadvice ,f (after emacspeak pre act comp)
  123. "Provide auditory feedback."
  124. (when (interactive-p)
  125. (emacspeak-auditory-icon 'select-object)
  126. (emacspeak-speak-mode-line)))))
  127. ;;}}}
  128. ;;{{{ set up programming mode:
  129. (add-hook 'ess-mode-hook 'emacspeak-setup-programming-mode)
  130. ;;}}}
  131. (provide 'emacspeak-ess)
  132. ;;{{{ end of file
  133. ;;; local variables:
  134. ;;; folded-file: t
  135. ;;; byte-compile-dynamic: t
  136. ;;; end:
  137. ;;}}}