1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238
|
;;; emacspeak-gnuplot.el --- speech-enable gnuplot mode
;;; $Id: emacspeak-gnuplot.el,v 15.0 2001/11/20 20:05:28 raman Exp $
;;; $Author: raman $
;;; Description: Emacspeak extension to speech-enable
;;; gnuplot mode
;;; Keywords: Emacspeak, WWW interaction
;;{{{ LCD Archive entry:
;;; LCD Archive Entry:
;;; emacspeak| T. V. Raman |raman@cs.cornell.edu
;;; A speech interface to Emacs |
;;; $Date: 2001/11/20 20:05:28 $ |
;;; $Revision: 15.0 $ |
;;; Location undetermined
;;;
;;}}}
;;{{{ Copyright:
;;; Copyright (C) 1995 -- 2001, T. V. Raman<raman@cs.cornell.edu>
;;; All Rights Reserved.
;;;
;;; This file is not part of GNU Emacs, but the same permissions apply.
;;;
;;; GNU Emacs is free software; you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 2, or (at your option)
;;; any later version.
;;;
;;; GNU Emacs is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Emacs; see the file COPYING. If not, write to
;;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
;;}}}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;{{{ required modules
(eval-when-compile (require 'cl))
(declaim (optimize (safety 0) (speed 3)))
(require 'advice)
(require 'emacspeak-speak)
(require 'voice-lock)
(require 'emacspeak-fix-interactive)
(require 'emacspeak-sounds)
;;}}}
;;{{{ Introduction:
;;; Commentary:
;;; This module speech-enables gnuplot-mode
;;; an Emacs add-on that enables fluent interaction with
;;; gnuplot.
;;; Use gnuplot to generate plots of mathematical functions
;;; for inclusion in documents.
;;; Code:
;;}}}
;;{{{ set up voice locking
(voice-lock-set-major-mode-keywords 'gnuplot-mode
'gnuplot-voice-lock-keywords)
(defvar gnuplot-voice-lock-keywords nil
"Voice lock keywords for gnuplot mode.")
(setq gnuplot-voice-lock-keywords
(list
; comments
'("#.*$" . voice-lock-comment-personality)
; quoted things
;'("['\"]\\([^'\"\n]*\\)['\"]"
; 1 voice-lock-string-personality)
'("'[^'\n]*'?" . voice-lock-string-personality)
; stuff in brackets, sugg. by <LB>
'("\\[\\([^]]+\\)\\]"
1 voice-lock-reference-personality)
; variable/function definitions
'("\\(\\<[a-z]+[a-z_0-9()]*\\)[ \t]*="
1 voice-lock-variable-name-personality)
; built-in function names
(cons
(concat
"\\<\\("
"a\\(bs\\|cosh\?\\|rg\\|sinh\?\\|"
"tan\\(\\|\[2h\]\\)\\)\\|"
"bes\\(j\[01\]\\|y\[01\]\\)\\|"
"c\\(eil\\|o\\(lumn\\|sh\?\\)\\)\\|"
"e\\(rfc\?\\|xp\\)\\|floor\\|gamma\\|"
"i\\(beta\\|gamma\\|mag\\|"
"n\\(t\\|v\\(erf\\|norm\\)\\)\\)\\|"
"l\\(gamma\\|og\\(\\|10\\)\\)\\|"
"norm\\|r\\(and\\|eal\\)\\|"
"s\\(gn\\|inh\?\\|qrt\\)\\|"
"t\\(anh\?\\|m_\\(hour\\|m\\(day\\|in\\|on\\)\\|"
"sec\\|wday\\|y\\(day\\|ear\\)\\)\\)\\|"
"valid"
"\\)\\>")
'voice-lock-function-name-personality)
; (s)plot -- also thing (s)plotted
'("\\<s?plot\\>" . voice-lock-keyword-personality)
'("\\<s?plot\\s-+\\([^'\" ]+\\)[) \n,\\\\]"
1 voice-lock-variable-name-personality)
; other common commands
; miscellaneous commands
(cons
(concat "\\<\\("
"c\\(d\\|lear\\)\\|exit\\|fit\\|help\\|load\\|"
"p\\(ause\\|rint\\|wd\\)\\|quit\\|replot\\|"
"s\\(ave\\|et\\|how\\)"
"\\)\\>\\|!.*$")
'voice-lock-reference-personality))
)
;;}}}
;;{{{ advice interactive commands
(defadvice gnuplot-send-region-to-gnuplot (after emacspeak
pre act
comp)
"Speak status."
(when (interactive-p)
(emacspeak-auditory-icon 'select-object)
(emacspeak-speak-other-window 1)))
(defadvice gnuplot-send-line-to-gnuplot (after emacspeak
pre act
comp)
"Speak status."
(when (interactive-p)
(emacspeak-auditory-icon 'select-object)
(emacspeak-speak-other-window 1)))
(defadvice gnuplot-send-line-and-forward (after emacspeak
pre act
comp)
"Speak status."
(when (interactive-p)
(emacspeak-auditory-icon 'select-object)
(emacspeak-speak-other-window 1)))
(defadvice gnuplot-send-buffer-to-gnuplot (after emacspeak
pre act
comp)
"Speak status."
(when (interactive-p)
(emacspeak-auditory-icon 'select-object)
(emacspeak-speak-other-window 1)))
(defadvice gnuplot-send-file-to-gnuplot (after emacspeak
pre act
comp)
"Speak status."
(when (interactive-p)
(emacspeak-auditory-icon 'select-object)
(emacspeak-speak-other-window 1)))
(defadvice gnuplot-delchar-or-maybe-eof (around emacspeak pre act)
"Speak character you're deleting."
(cond
((interactive-p )
(cond
((= (point) (point-max))
(message "Sending EOF to comint process"))
(t (dtk-tone 500 30 'force)
(and emacspeak-delete-char-speak-deleted-char
(emacspeak-speak-char t))))
ad-do-it
(and emacspeak-delete-char-speak-current-char
(emacspeak-speak-char t)))
(t ad-do-it))
ad-return-value)
(defadvice gnuplot-kill-gnuplot-buffer (after emacspeak pre
act comp)
"Provide auditory feedback."
(when (interactive-p)
(emacspeak-auditory-icon 'close-object)
(emacspeak-speak-mode-line)))
(defadvice gnuplot-show-gnuplot-buffer (after emacspeak pre
act comp)
"Speak status."
(when (interactive-p)
(emacspeak-auditory-icon 'select-object)
(emacspeak-speak-mode-line)))
(defadvice gnuplot-complete-keyword (around emacspeak pre act)
"Say what you completed."
(let ((prior (point ))
(dtk-stop-immediately dtk-stop-immediately))
(when dtk-stop-immediately (dtk-stop))
ad-do-it
(when (> (point) prior)
(setq dtk-stop-immediately nil)
(dtk-speak (buffer-substring prior (point ))))
ad-return-value))
(defadvice gnuplot-indent-line (after emacspeak pre act
comp)
"Speak line we idnented."
(when (interactive-p)
(emacspeak-auditory-icon 'large-movement)
(emacspeak-speak-line)))
(defadvice gnuplot-negate-option (after emacspeak pre act comp)
"Speak line we negated."
(when (interactive-p)
(emacspeak-auditory-icon 'select-object)
(emacspeak-speak-line)))
(add-hook 'gnuplot-mode-hook
(function
(lambda nil
(dtk-set-punctuations "all")
(voice-lock-mode t))))
;;}}}
(provide 'emacspeak-gnuplot)
;;{{{ end of file
;;; local variables:
;;; folded-file: t
;;; byte-compile-dynamic: t
;;; end:
;;}}}
|